intel_pmic_gpio: fix off-by-one value range checking
PATCH 1/1 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 <[email protected]>
--- drivers/platform/x86/intel_pmic_gpio.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/platform/x86/intel_pmic_gpio.c +1 -1
@@ -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);
Signature · 1 line
1.7.2
Quoted 4 lines · On Fri, 08 Oct 2010 17:54:31 +0800 Axel Lin <[email protected]> wrote:
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 <[email protected]>
Agreed - thanks for spotting this.
Alan
Matthew Garrett
AppliedApplied, thanks.
Signature · 1 line
Matthew Garrett | [email protected]