[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1365337700.3916.1.camel@phoenix>
Date: Sun, 07 Apr 2013 20:28:20 +0800
From: Axel Lin <axel.lin@...ics.com>
To: Grant Likely <grant.likely@...retlab.ca>,
Linus Walleij <linus.walleij@...aro.org>
Cc: Kevin Wells <kevin.wells@....com>, linux-kernel@...r.kernel.org
Subject: [PATCH] gpio: lpc32xx: Fix off-by-one valid range checking for bank
The valid bank should be 0 ... ARRAY_SIZE(lpc32xx_gpiochip) - 1.
Signed-off-by: Axel Lin <axel.lin@...ics.com>
---
drivers/gpio/gpio-lpc32xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c
index 36d7dee..dda6a75 100644
--- a/drivers/gpio/gpio-lpc32xx.c
+++ b/drivers/gpio/gpio-lpc32xx.c
@@ -533,7 +533,7 @@ static int lpc32xx_of_xlate(struct gpio_chip *gc,
{
/* Is this the correct bank? */
u32 bank = gpiospec->args[0];
- if ((bank > ARRAY_SIZE(lpc32xx_gpiochip) ||
+ if ((bank >= ARRAY_SIZE(lpc32xx_gpiochip) ||
(gc != &lpc32xx_gpiochip[bank].chip)))
return -EINVAL;
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists