summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-10-08 11:54:31 +0200
committerMatthew Garrett <mjg@redhat.com>2010-10-21 16:10:47 +0200
commit4119617919c243755946699808ffd0f4befa62c7 (patch)
treea3072ec2107810b3dac2e9da0e8c366bfe946e43
parentIBM Real-Time "SMI Free" mode driver -v7 (diff)
downloadlinux-4119617919c243755946699808ffd0f4befa62c7.tar.xz
linux-4119617919c243755946699808ffd0f4befa62c7.zip
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>
-rw-r--r--drivers/platform/x86/intel_pmic_gpio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c
index c6e2a1d4fadc..f540ff96c53f 100644
--- a/drivers/platform/x86/intel_pmic_gpio.c
+++ b/drivers/platform/x86/intel_pmic_gpio.c
@@ -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);