2009-01-17 15:12:51

by Roel Kluin

[permalink] [raw]
Subject: [PATCH] leds: Fix bounds checking of wm8350->pmic.led

Fix bounds checking of wm8350->pmic.led

Signed-off-by: Roel Kluin <[email protected]>
---
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 7aa3524..5056e23 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1435,7 +1435,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
struct platform_device *pdev;
int ret;

- if (lednum > ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
+ if (lednum >= ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
dev_err(wm8350->dev, "Invalid LED index %d\n", lednum);
return -ENODEV;
}


2009-01-17 16:05:54

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] leds: Fix bounds checking of wm8350->pmic.led

On Sat, Jan 17, 2009 at 04:06:40PM +0100, Roel Kluin wrote:
> Fix bounds checking of wm8350->pmic.led

> Signed-off-by: Roel Kluin <[email protected]>

Acked-by: Mark Brown <[email protected]>

but it probably ought to get pushed out via MFD - I'll send it along to
Samuel.

2009-01-17 16:08:42

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH] leds: Fix bounds checking of wm8350->pmic.led

On Sat, Jan 17, 2009 at 04:05:32PM +0000, Mark Brown wrote:

> but it probably ought to get pushed out via MFD - I'll send it along to
> Samuel.

Eh, sorry - I meant regulator and Liam

2009-01-17 16:21:06

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH] leds: Fix bounds checking of wm8350->pmic.led

On Sat, 2009-01-17 at 16:06 +0100, Roel Kluin wrote:
> Fix bounds checking of wm8350->pmic.led
>
> Signed-off-by: Roel Kluin <[email protected]>
> ---
> diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
> index 7aa3524..5056e23 100644
> --- a/drivers/regulator/wm8350-regulator.c
> +++ b/drivers/regulator/wm8350-regulator.c
> @@ -1435,7 +1435,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
> struct platform_device *pdev;
> int ret;
>
> - if (lednum > ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
> + if (lednum >= ARRAY_SIZE(wm8350->pmic.led) || lednum < 0) {
> dev_err(wm8350->dev, "Invalid LED index %d\n", lednum);
> return -ENODEV;
> }
> --

Applied.

Thanks

Liam