All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>,
	u-boot@lists.denx.de, Eugeniu Rosca <erosca@de.adit-jv.com>
Subject: Re: [PATCH 1/1] net: phy: Fix signed shift overflow
Date: Thu, 28 Mar 2024 11:09:09 -0400	[thread overview]
Message-ID: <20240328150909.GX3442575@bill-the-cat> (raw)
In-Reply-To: <20240104042623.103398-1-heinrich.schuchardt@canonical.com>

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

On Thu, Jan 04, 2024 at 05:26:23AM +0100, Heinrich Schuchardt wrote:

> From: Eugeniu Rosca <erosca@de.adit-jv.com>
> 
> Booting R-Car Gen3 arm64 U-Boot with CONFIG_UBSAN=y resulted in:
> 
>  =====================================================================
>  UBSAN: Undefined behaviour in drivers/net/phy/phy.c:728:19
>  left shift of 1 by 31 places cannot be represented in type 'int'
>  =====================================================================
> 
> Fix it by appending the UL suffix to the numeric literal. While at it,
> convert the type of "addr" variable from signed to unsigned, to protect
> against shifting the numeric literal by a negative value (which would
> lead to yet another undefined behavior).
> 
> Fixes: 1adb406b0141 ("phy: add phy_find_by_mask/phy_connect_dev")
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
> 
> * Using U-suffix for integer is sufficient.
> * ffs() of non-zero value cannot be 0. But addr being unsigned is
> * preferable.
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

      reply	other threads:[~2024-03-28 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04  4:26 [PATCH 1/1] net: phy: Fix signed shift overflow Heinrich Schuchardt
2024-03-28 15:09 ` Tom Rini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240328150909.GX3442575@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=erosca@de.adit-jv.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.