linux-stable/drivers/net/phy/aquantia
Arnd Bergmann cff865c700 net: phy: avoid undefined behavior in *_led_polarity_set()
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: 1758af47b9 ("net: phy: intel-xway: add support for PHY LEDs")
Fixes: 9d55e68b19 ("net: phy: aquantia: correctly describe LED polarity override")
Fixes: eb89c79c1b ("net: phy: mxl-gpy: correctly describe LED polarity")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241217081056.238792-1-arnd@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-12-18 16:50:23 -08:00
..
aquantia_firmware.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
aquantia_hwmon.c
aquantia_leds.c net: phy: avoid undefined behavior in *_led_polarity_set() 2024-12-18 16:50:23 -08:00
aquantia_main.c net: phy: aquantia: Add mdix config and reporting 2024-11-11 16:43:29 -08:00
aquantia.h net: phy: aquantia: correctly describe LED polarity override 2024-10-15 11:24:21 +02:00
Kconfig net: phy: aquantia: switch to crc_itu_t() 2024-01-04 13:14:31 -08:00
Makefile net: phy: aquantia: add support for PHY LEDs 2024-06-05 10:21:31 +01:00