linux-stable/drivers/leds
Christian Marangi db76d11bda leds: trigger: netdev: Move size check in set_device_name
commit 259e33cbb1 upstream.

GCC 13.2 complains about array subscript 17 is above array bounds of
'char[16]' with IFNAMSIZ set to 16.

The warning is correct but this scenario is impossible.
set_device_name is called by device_name_store (store sysfs entry) and
netdev_trig_activate.

device_name_store already check if size is >= of IFNAMSIZ and return
-EINVAL. (making the warning scenario impossible)

netdev_trig_activate works on already defined interface, where the name
has already been checked and should already follow the condition of
strlen() < IFNAMSIZ.

Aside from the scenario being impossible, set_device_name can be
improved to both mute the warning and make the function safer.
To make it safer, move size check from device_name_store directly to
set_device_name and prevent any out of bounds scenario.

Cc: stable@vger.kernel.org
Fixes: 28a6a2ef18 ("leds: trigger: netdev: refactor code setting device name")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202309192035.GTJEEbem-lkp@intel.com/
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20231007131042.15032-1-ansuelsmth@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-28 17:15:06 +00:00
..
blink leds: lgm-sso: switch to using devm_fwnode_gpiod_get() 2022-11-09 13:59:28 +01:00
flash leds: sgm3140: Add richtek,rt5033-led compatible 2023-06-21 19:09:28 +01:00
rgb - New Drivers 2023-07-03 11:26:05 -07:00
simple leds: simatic-ipc-leds-gpio: Restore LEDS_CLASS dependency 2023-09-13 09:53:46 +02:00
trigger leds: trigger: netdev: Move size check in set_device_name 2023-11-28 17:15:06 +00:00
Kconfig leds: Add AW20xx driver 2023-06-01 19:46:35 +01:00
Makefile leds: Fix config reference for AW200xx driver 2023-06-15 15:06:54 +01:00
TODO
led-class-flash.c
led-class-multicolor.c leds: multicolor: Use rounded division when calculating color components 2023-09-13 09:53:47 +02:00
led-class.c leds: Replace all non-returning strlcpy with strscpy 2023-05-25 12:31:55 +01:00
led-core.c leds: Drop BUG_ON check for LED_COLOR_ID_MULTI 2023-10-10 22:02:59 +02:00
led-triggers.c leds: Clear LED_INIT_DEFAULT_TRIGGER when clearing current trigger 2023-05-25 12:16:33 +01:00
leds-88pm860x.c
leds-acer-a500.c
leds-adp5520.c
leds-an30259a.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-apu.c
leds-ariel.c
leds-aw200xx.c leds: aw200xx: Fix error code in probe() 2023-09-13 09:53:46 +02:00
leds-aw2013.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-bcm6328.c leds: bcm6328: Get rid of custom led_init_default_state_get() 2023-01-30 08:03:37 +00:00
leds-bcm6358.c leds: bcm6358: Get rid of custom led_init_default_state_get() 2023-01-30 08:03:38 +00:00
leds-bd2606mvv.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-bd2802.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-blinkm.c leds: blinkm: Replace all non-returning strlcpy with strscpy 2023-05-25 12:31:18 +01:00
leds-cht-wcove.c leds: cht-wcove: Remove unneeded semicolon 2023-06-08 18:11:14 +01:00
leds-clevo-mail.c
leds-cobalt-qube.c
leds-cobalt-raq.c
leds-cpcap.c
leds-cr0014114.c
leds-da903x.c
leds-da9052.c
leds-dac124s085.c
leds-el15203000.c
leds-gpio-register.c
leds-gpio.c leds: gpio: Configure per-LED pin control 2023-05-25 12:34:30 +01:00
leds-hp6xx.c
leds-ip30.c
leds-ipaq-micro.c
leds-is31fl32xx.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-is31fl319x.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm355x.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm3530.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm3532.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm3533.c leds: use sysfs_emit() to instead of scnprintf() 2022-12-07 21:05:20 +01:00
leds-lm3642.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm3692x.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm3697.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lm36274.c
leds-locomo.c ARM: pxa: split up mach/hardware.h 2022-04-19 16:27:05 +02:00
leds-lp50xx.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp55xx-common.c leds: lp55xx: Configure internal charge pump 2023-05-25 12:16:05 +01:00
leds-lp55xx-common.h
leds-lp3944.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp3952.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp5521.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp5523.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp5562.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp8501.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lp8788.c
leds-lp8860.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-lt3593.c
leds-max8997.c leds: max8997: Don't error if there is no pdata 2022-10-22 11:55:03 +02:00
leds-max77650.c
leds-mc13783.c
leds-menf21bmc.c
leds-mlxcpld.c
leds-mlxreg.c
leds-mt6323.c leds: leds-mt6323: Adjust return/parameter types in wled get/set callbacks 2023-06-23 10:57:14 +01:00
leds-net48xx.c
leds-netxbig.c
leds-nic78bx.c
leds-ns2.c
leds-ot200.c
leds-pca955x.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-pca963x.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-pca9532.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-pm8058.c leds: pm8058: Get rid of custom led_init_default_state_get() 2023-01-30 08:03:41 +00:00
leds-powernv.c
leds-pwm.c leds: pwm: Don't disable the PWM when the LED should be off 2023-11-20 11:57:12 +01:00
leds-rb532.c
leds-regulator.c leds: regulator: Make probeable from device tree 2022-05-05 10:04:52 +02:00
leds-sc27xx-bltc.c
leds-spi-byte.c leds: Replace all non-returning strlcpy with strscpy 2023-05-25 12:31:55 +01:00
leds-ss4200.c
leds-sunfire.c
leds-syscon.c leds: syscon: Get rid of custom led_init_default_state_get() 2023-01-30 08:03:42 +00:00
leds-tca6507.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-ti-lmu-common.c
leds-tlc591xx.c leds: Switch i2c drivers back to use .probe() 2023-05-25 12:16:22 +01:00
leds-tps6105x.c
leds-turris-omnia.c leds: turris-omnia: Do not use SMBUS calls 2023-11-20 11:57:12 +01:00
leds-wm831x-status.c
leds-wm8350.c
leds-wrap.c
leds.h leds: Move led_init_default_state_get() to the global header 2023-01-30 08:03:35 +00:00
uleds.c