diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-12-16 18:53:59 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-15 11:23:19 -0500 |
commit | d3c2155ce5889731de5d18c53f7fbde2d1b87e00 (patch) | |
tree | 253ef0f62a1fc03a0b1f3c4d6c97b3fa9e28e694 /drivers/gpio/gpio-grgpio.c | |
parent | 53e41f554a0cbad139ee5072bbb49b4951f680c2 (diff) |
gpio: grgpio: off by one in grgpio_to_irq()
"gc->ngpio" is a number between 1 and GRGPIO_MAX_NGPIO. If "offset" is
GRGPIO_MAX_NGPIO then we're going one step beyond the end of the
priv->lirqs[] array.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-grgpio.c')
-rw-r--r-- | drivers/gpio/gpio-grgpio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-grgpio.c b/drivers/gpio/gpio-grgpio.c index 09daaf2aeb56..d5bc70fce4df 100644 --- a/drivers/gpio/gpio-grgpio.c +++ b/drivers/gpio/gpio-grgpio.c | |||
@@ -121,7 +121,7 @@ static int grgpio_to_irq(struct gpio_chip *gc, unsigned offset) | |||
121 | { | 121 | { |
122 | struct grgpio_priv *priv = grgpio_gc_to_priv(gc); | 122 | struct grgpio_priv *priv = grgpio_gc_to_priv(gc); |
123 | 123 | ||
124 | if (offset > gc->ngpio) | 124 | if (offset >= gc->ngpio) |
125 | return -ENXIO; | 125 | return -ENXIO; |
126 | 126 | ||
127 | if (priv->lirqs[offset].index < 0) | 127 | if (priv->lirqs[offset].index < 0) |