From: Axel Lin Date: Wed, 26 May 2010 21:42:19 +0000 (-0700) Subject: pl061: fix offset value range checking X-Git-Tag: firefly_0821_release~9833^2~1832 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c1cc9b9775c931a0015178daf92d41aec00580de;p=firefly-linux-kernel-4.4.55.git pl061: fix offset value range checking The valid offset value is 0..PL061_GPIO_NR-1, this patch corrects the offset value range checking. Signed-off-by: Axel Lin Acked-by: Baruch Siach Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c index 105701a1f05b..ee568c8fcbd0 100644 --- a/drivers/gpio/pl061.c +++ b/drivers/gpio/pl061.c @@ -164,7 +164,7 @@ static int pl061_irq_type(unsigned irq, unsigned trigger) unsigned long flags; u8 gpiois, gpioibe, gpioiev; - if (offset < 0 || offset > PL061_GPIO_NR) + if (offset < 0 || offset >= PL061_GPIO_NR) return -EINVAL; spin_lock_irqsave(&chip->irq_lock, flags);