platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] intel_pmic_gpio: fix off-by-one value range checking
@ 2010-10-08  9:54 Axel Lin
  2010-10-13  9:11 ` Alan Cox
  2010-10-21 14:04 ` Matthew Garrett
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2010-10-08  9:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Matthew Garrett, Alek Du, Alan Cox, platform-driver-x86

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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] intel_pmic_gpio: fix off-by-one value range checking
  2010-10-08  9:54 [PATCH] intel_pmic_gpio: fix off-by-one value range checking Axel Lin
@ 2010-10-13  9:11 ` Alan Cox
  2010-10-21 14:04 ` Matthew Garrett
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Cox @ 2010-10-13  9:11 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Matthew Garrett, Alek Du, platform-driver-x86

On Fri, 08 Oct 2010 17:54:31 +0800
Axel Lin <axel.lin@gmail.com> 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 <axel.lin@gmail.com>

Agreed - thanks for spotting this.

Alan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] intel_pmic_gpio: fix off-by-one value range checking
  2010-10-08  9:54 [PATCH] intel_pmic_gpio: fix off-by-one value range checking Axel Lin
  2010-10-13  9:11 ` Alan Cox
@ 2010-10-21 14:04 ` Matthew Garrett
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Garrett @ 2010-10-21 14:04 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Alek Du, Alan Cox, platform-driver-x86

Applied, thanks.

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-21 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-08  9:54 [PATCH] intel_pmic_gpio: fix off-by-one value range checking Axel Lin
2010-10-13  9:11 ` Alan Cox
2010-10-21 14:04 ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).