From 75b3c8e2a463cbe28a2449eb37c77e71701b2aa1 Mon Sep 17 00:00:00 2001 From: aineoae86-sys Date: Mon, 6 Jul 2026 03:04:37 +0800 Subject: [PATCH] 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 --- drivers/leds/lp503x.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/leds/lp503x.c b/drivers/leds/lp503x.c index 384bf9ed7ad..5e33e762be4 100644 --- a/drivers/leds/lp503x.c +++ b/drivers/leds/lp503x.c @@ -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);