gpio: grgpio: off by one in grgpio_to_irq()
Subsystems (2)
PATCH 1/1 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 <[email protected]>
drivers/gpio/gpio-grgpio.c +1 -1
@@ -121,7 +121,7 @@ static int grgpio_to_irq(struct gpio_chip *gc, unsigned offset) {struct grgpio_priv *priv =grgpio_gc_to_priv (gc); -if (offset > gc->ngpio) +if (offset >= gc->ngpio)return -ENXIO ;if (priv->lirqs[offset].index <0 )
Quoted 5 lines · Dan Carpenter
"
gc->ngpio" is a number between 1 andGRGPIO_MAX_NGPIO. If "offset" isGRGPIO_MAX_NGPIOthen we're going one step beyond the end of the priv->lirqs[] array.Signed-off-by Dan Carpenter <[email protected]>
Reviewed-by Alexandre Courbot <[email protected]>
Quoted 5 lines · Dan Carpenter
"
gc->ngpio" is a number between 1 andGRGPIO_MAX_NGPIO. If "offset" isGRGPIO_MAX_NGPIOthen we're going one step beyond the end of the priv->lirqs[] array.Signed-off-by Dan Carpenter <[email protected]>
Patch applied with Alex's ACK.
Yours,
Linus Walleij