summaryrefslogtreecommitdiff
path: root/drivers/of
diff options
context:
space:
mode:
authorRoland Stigge <stigge@antcom.de>2012-04-04 00:02:58 (GMT)
committerGrant Likely <grant.likely@secretlab.ca>2012-04-10 20:20:56 (GMT)
commit6270d830d030da48eddffbe31ed1e4444f203fc5 (patch)
treebf2cfab7799ca158e65d9cf57c90d5fed395e6b2 /drivers/of
parent078dc65e61c562e289685fe43b5ef58118e033fc (diff)
downloadlinux-6270d830d030da48eddffbe31ed1e4444f203fc5.tar.xz
gpio: Fix range check in of_gpio_simple_xlate()
of_gpio_simple_xlate() has an off-by-one bug where it checks to see if args[0] is > ngpio instead of >=. args[0] must always be less than ngpio because it is a zero-based enumeration. Signed-off-by: Roland Stigge <stigge@antcom.de> [grant.likely: beef up commit text] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/gpio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c
index bba8121..bf984b6 100644
--- a/drivers/of/gpio.c
+++ b/drivers/of/gpio.c
@@ -140,7 +140,7 @@ int of_gpio_simple_xlate(struct gpio_chip *gc,
if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells))
return -EINVAL;
- if (gpiospec->args[0] > gc->ngpio)
+ if (gpiospec->args[0] >= gc->ngpio)
return -EINVAL;
if (flags)