mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 06:04:28 +08:00
drivers: leds: Fix LP503X bank mode LED bounds
PWMIOC_ENABLE_LED_BANK_MODE uses the provided LED number to index the LP503X led_mode array. Reject values outside the RGB LED range before writing that array. Generated-by: OpenAI Codex Signed-off-by: aineoae86-sys <ai.neo.ae86@gmail.com>
This commit is contained in:
committed by
Alin Jerpelea
parent
bfc6df0fdc
commit
75b3c8e2a4
@@ -829,6 +829,12 @@ static int lp503x_ioctl(struct file *filep, int cmd,
|
||||
break;
|
||||
|
||||
case PWMIOC_ENABLE_LED_BANK_MODE: /* led(0..11), mode required */
|
||||
if (lp503x_ioctl_args->lednum > MAX_RGB_LEDS)
|
||||
{
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
ledinfo("INFO: setting LED %d mode to %" PRIx32 "\n",
|
||||
lp503x_ioctl_args->lednum,
|
||||
lp503x_ioctl_args->param);
|
||||
|
||||
Reference in New Issue
Block a user