Skip to content

Commit

Permalink
intel_pmic_gpio: fix off-by-one value range checking
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Axel Lin authored and Matthew Garrett committed Oct 21, 2010
1 parent 35f0ce0 commit 4119617
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/platform/x86/intel_pmic_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4119617

Please sign in to comment.