mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Xu Liang <lxu@maxlinear.com>,
	Daniel Golle <daniel@makrotopia.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Raju Lakkaraju <Raju.Lakkaraju@microchip.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: phy: avoid undefined behavior in *_led_polarity_set()
Date: Tue, 17 Dec 2024 16:01:35 +0100	[thread overview]
Message-ID: <73474cad-ebe1-4602-858c-825e72b0e3af@lunn.ch> (raw)
In-Reply-To: <20241217081056.238792-1-arnd@kernel.org>

On Tue, Dec 17, 2024 at 09:10:34AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> gcc runs into undefined behavior at the end of the three led_polarity_set()
> callback functions if it were called with a zero 'modes' argument and it
> just ends the function there without returning from it.
> 
> This gets flagged by 'objtool' as a function that continues on
> to the next one:
> 
> drivers/net/phy/aquantia/aquantia_leds.o: warning: objtool: aqr_phy_led_polarity_set+0xf: can't find jump dest instruction at .text+0x5d9
> drivers/net/phy/intel-xway.o: warning: objtool: xway_gphy_led_polarity_set() falls through to next function xway_gphy_config_init()
> drivers/net/phy/mxl-gpy.o: warning: objtool: gpy_led_polarity_set() falls through to next function gpy_led_hw_control_get()
> 
> There is no point to micro-optimize the behavior here to save a single-digit
> number of bytes in the kernel, so just change this to a "return -EINVAL"
> as we do when any unexpected bits are set.
> 
> Fixes: 1758af47b98c ("net: phy: intel-xway: add support for PHY LEDs")
> Fixes: 9d55e68b19f2 ("net: phy: aquantia: correctly describe LED polarity override")
> Fixes: eb89c79c1b8f ("net: phy: mxl-gpy: correctly describe LED polarity")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

  reply	other threads:[~2024-12-17 15:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17  8:10 Arnd Bergmann
2024-12-17 15:01 ` Andrew Lunn [this message]
2024-12-19  1:50 ` patchwork-bot+netdevbpf

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=73474cad-ebe1-4602-858c-825e72b0e3af@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Raju.Lakkaraju@microchip.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=jpoimboe@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lxu@maxlinear.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peterz@infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®