[ARM] Off-by-one in arch/arm/common/icst*
authorEric Sesterhenn <snakebyte@gmx.de>
Tue, 26 Sep 2006 12:22:00 +0000 (14:22 +0200)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 27 Sep 2006 22:17:54 +0000 (23:17 +0100)
hi,

a quick find -iname \*.[ch] | xargs grep "> ARRAY_SIZE(", revealed
these in the icst drivers.
If i == ARRAY_SIZE, we get past the idx2s array.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/common/icst307.c
arch/arm/common/icst525.c

index bafe8b19be82a422ada8f2617a60b8022e584f08..6d094c1575400d0487b754ecb6a723ee474435dd 100644 (file)
@@ -57,7 +57,7 @@ icst307_khz_to_vco(const struct icst307_params *p, unsigned long freq)
                        break;
        } while (i < ARRAY_SIZE(idx2s));
 
-       if (i > ARRAY_SIZE(idx2s))
+       if (i >= ARRAY_SIZE(idx2s))
                return vco;
 
        vco.s = idx2s[i];
@@ -119,7 +119,7 @@ icst307_ps_to_vco(const struct icst307_params *p, unsigned long period)
                        break;
        } while (i < ARRAY_SIZE(idx2s));
 
-       if (i > ARRAY_SIZE(idx2s))
+       if (i >= ARRAY_SIZE(idx2s))
                return vco;
 
        vco.s = idx2s[i];
index 943ef88c0379b79ee25505392cb21f3ade0a523f..3d377c5bdef6299332c068974753a0c41e8c939d 100644 (file)
@@ -55,7 +55,7 @@ icst525_khz_to_vco(const struct icst525_params *p, unsigned long freq)
                        break;
        } while (i < ARRAY_SIZE(idx2s));
 
-       if (i > ARRAY_SIZE(idx2s))
+       if (i >= ARRAY_SIZE(idx2s))
                return vco;
 
        vco.s = idx2s[i];
@@ -118,7 +118,7 @@ icst525_ps_to_vco(const struct icst525_params *p, unsigned long period)
                        break;
        } while (i < ARRAY_SIZE(idx2s));
 
-       if (i > ARRAY_SIZE(idx2s))
+       if (i >= ARRAY_SIZE(idx2s))
                return vco;
 
        vco.s = idx2s[i];