[openwrt/openwrt] realtek: rtl930x: Fix out-of-bounds check in LED set configuration
LEDE Commits
lede-commits at lists.infradead.org
Mon Oct 6 15:15:48 PDT 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/fb01b901e739b0a5db2088b09fb018c906206995
commit fb01b901e739b0a5db2088b09fb018c906206995
Author: Sven Eckelmann <se at simonwunderlich.de>
AuthorDate: Tue Jul 15 19:53:07 2025 +0200
realtek: rtl930x: Fix out-of-bounds check in LED set configuration
of_property_count_u32_elems returns the number of u32 and not the number of
bytes. It must therefore be checked against the number of u32 in set_config
and not the bytes in set_config.
Fixes: 2cfb1ecf1035 ("rtl930x: Rework per port LED configuration")
Signed-off-by: Sven Eckelmann <se at simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/20300
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
index 0a83a0624c..e507a931cf 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
@@ -2392,10 +2392,10 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv)
sprintf(set_name, "led_set%d", set);
leds_in_this_set = of_property_count_u32_elems(node, set_name);
- if (leds_in_this_set <= 0 || leds_in_this_set > sizeof(set_config)) {
+ if (leds_in_this_set <= 0 || leds_in_this_set > ARRAY_SIZE(set_config)) {
if (leds_in_this_set != -EINVAL) {
dev_err(dev, "%s invalid, skipping this set, leds_in_this_set=%d, should be (0, %d]\n",
- set_name, leds_in_this_set, sizeof(set_config));
+ set_name, leds_in_this_set, ARRAY_SIZE(set_config));
}
continue;
}
More information about the lede-commits
mailing list