mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-27 11:55:53 +00:00
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@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
97ddb1c88b
commit
fdc7a9f85a
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user