[patch 1/3] s3c: fix check of index into s3c_gpios[]

akpm at linux-foundation.org akpm at linux-foundation.org
Fri Sep 18 15:44:17 EDT 2009


From: Roel Kluin <roel.kluin at gmail.com>

The check of the s3c_gpios[] index had an off-by-one.

Signed-off-by: Roel Kluin <roel.kluin at gmail.com>
Acked-by: Ben Dooks <ben-linux at fluff.org>
Cc: Russell King <rmk at arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 arch/arm/plat-s3c/gpio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN arch/arm/plat-s3c/gpio.c~s3c-fix-check-of-index-into-s3c_gpios arch/arm/plat-s3c/gpio.c
--- a/arch/arm/plat-s3c/gpio.c~s3c-fix-check-of-index-into-s3c_gpios
+++ a/arch/arm/plat-s3c/gpio.c
@@ -28,7 +28,7 @@ static __init void s3c_gpiolib_track(str
 
 	gpn = chip->chip.base;
 	for (i = 0; i < chip->chip.ngpio; i++, gpn++) {
-		BUG_ON(gpn > ARRAY_SIZE(s3c_gpios));
+		BUG_ON(gpn >= ARRAY_SIZE(s3c_gpios));
 		s3c_gpios[gpn] = chip;
 	}
 }
_



More information about the linux-arm-kernel mailing list