pl061: fix offset value range checking
authorAxel Lin <[email protected]>
Wed, 26 May 2010 21:42:19 +0000 (14:42 -0700)
committerLinus Torvalds <[email protected]>
Thu, 27 May 2010 16:12:41 +0000 (09:12 -0700)
The valid offset value is 0..PL061_GPIO_NR-1, this patch corrects the
offset value range checking.

Signed-off-by: Axel Lin <[email protected]>
Acked-by: Baruch Siach <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/gpio/pl061.c

index 105701a1f05be48e87c9862a80a907437e03863d..ee568c8fcbd01db804dc071be08a1da4b5ee6e87 100644 (file)
@@ -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);