This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/13.0 by this push:
new 08240daf611 drivers: leds: Fix LP503X bank mode LED bounds
08240daf611 is described below
commit 08240daf6118c67e385204660142fddff92cdc27
Author: aineoae86-sys <[email protected]>
AuthorDate: Mon Jul 6 03:04:37 2026 +0800
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 <[email protected]>
---
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);