[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <73474cad-ebe1-4602-858c-825e72b0e3af@lunn.ch>
Date: Tue, 17 Dec 2024 16:01:35 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Xu Liang <lxu@...linear.com>, Daniel Golle <daniel@...rotopia.org>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Arnd Bergmann <arnd@...db.de>,
Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: phy: avoid undefined behavior in
*_led_polarity_set()
On Tue, Dec 17, 2024 at 09:10:34AM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.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@...db.de>
Reviewed-by: Andrew Lunn <andrew@...n.ch>
Andrew
Powered by blists - more mailing lists