diff options
| author | Axel Lin <[email protected]> | 2013-04-07 12:28:20 +0000 |
|---|---|---|
| committer | Linus Walleij <[email protected]> | 2013-04-10 21:41:17 +0000 |
| commit | fdc7a9f85ab4c19acfc21e4da6ff8b7000bb686c (patch) | |
| tree | 5e811b761ea73d80c977d6db2fd212dfe4fd7376 | |
| parent | gpio: mcp23s08: convert driver to DT (diff) | |
| download | kernel-fdc7a9f85ab4c19acfc21e4da6ff8b7000bb686c.tar.gz kernel-fdc7a9f85ab4c19acfc21e4da6ff8b7000bb686c.zip | |
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 <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
| -rw-r--r-- | drivers/gpio/gpio-lpc32xx.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-lpc32xx.c b/drivers/gpio/gpio-lpc32xx.c index 36d7dee07b28..dda6a756a3d9 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; |
