1
0
Fork 0

intel_pmic_gpio: fix off-by-one value range checking

In pmic_irq_type(), we use gpio as array index for trigger,
thus the valid value range for gpio should be 0 .. NUM_GPIO - 1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
hifive-unleashed-5.1
Axel Lin 2010-10-08 17:54:31 +08:00 committed by Matthew Garrett
parent 35f0ce032b
commit 4119617919
1 changed files with 1 additions and 1 deletions

View File

@ -197,7 +197,7 @@ static int pmic_irq_type(unsigned irq, unsigned type)
u32 gpio = irq - pg->irq_base;
unsigned long flags;
if (gpio > pg->chip.ngpio)
if (gpio >= pg->chip.ngpio)
return -EINVAL;
spin_lock_irqsave(&pg->irqtypes.lock, flags);