leds: netxbig: off by one in netxbig_leds_get_of_pdata()
Subsystems (2)
PATCH 1/2 leds: netxbig: off by one in netxbig_leds_get_of_pdata()
The mode_val[] array has NETXBIG_LED_MODE_NUM (5) elements so the ">" here should be ">=".
Signed-off-by Dan Carpenter <[email protected]>
drivers/leds/leds-netxbig.c +1 -1
@@ -512,7 +512,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev, "mode-val", 2 * i, &mode);of_property_read_u32_index (child,"mode-val" ,2 * i +1 , &val); -if (mode >NETXBIG_LED_MODE_NUM ) +if (mode >=NETXBIG_LED_MODE_NUM )return -EINVAL ; mode_val[mode] = val; }