linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: lpc32xx: Fix off-by-one valid range checking for bank
@ 2013-04-07 12:28 Axel Lin
  2013-04-10 19:49 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2013-04-07 12:28 UTC (permalink / raw)
  To: Grant Likely, Linus Walleij; +Cc: Kevin Wells, linux-kernel

The valid bank should be 0 ... ARRAY_SIZE(lpc32xx_gpiochip) - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.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




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: lpc32xx: Fix off-by-one valid range checking for bank
  2013-04-07 12:28 [PATCH] gpio: lpc32xx: Fix off-by-one valid range checking for bank Axel Lin
@ 2013-04-10 19:49 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2013-04-10 19:49 UTC (permalink / raw)
  To: Axel Lin; +Cc: Grant Likely, Kevin Wells, linux-kernel

On Sun, Apr 7, 2013 at 2:28 PM, Axel Lin <axel.lin@ingics.com> wrote:

> The valid bank should be 0 ... ARRAY_SIZE(lpc32xx_gpiochip) - 1.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

Yep, that's right. Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-10 19:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-07 12:28 [PATCH] gpio: lpc32xx: Fix off-by-one valid range checking for bank Axel Lin
2013-04-10 19:49 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).