[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1286531671.6060.1.camel@mola>
Date: Fri, 08 Oct 2010 17:54:31 +0800
From: Axel Lin <axel.lin@...il.com>
To: linux-kernel <linux-kernel@...r.kernel.org>
Cc: Matthew Garrett <mjg@...hat.com>, Alek Du <alek.du@...el.com>,
Alan Cox <alan@...ux.intel.com>,
platform-driver-x86@...r.kernel.org
Subject: [PATCH] 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@...il.com>
---
drivers/platform/x86/intel_pmic_gpio.c | 2 +-
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 c6e2a1d..f540ff9 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);
--
1.7.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists