Skip to contentSkip to conversation

Off-by-one in arch/arm/common/icst*

PATCH New Eric Sesterhenn 1 participant 1 message Sep 26, 2006 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Off-by-one in arch/arm/common/icst*

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.

arch/arm/common/icst307.c renamed from arch/arm/common/icst307.c.orig +2 -2
@@ -57,7 +57,7 @@ icst307_khz_to_vco(const struct icst307_
 			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_p
 			break;
 	} while (i < ARRAY_SIZE(idx2s));
 
-	if (i > ARRAY_SIZE(idx2s))
+	if (i >= ARRAY_SIZE(idx2s))
 		return vco;
 
 	vco.s = idx2s[i];
arch/arm/common/icst525.c renamed from arch/arm/common/icst525.c.orig +2 -2
@@ -55,7 +55,7 @@ icst525_khz_to_vco(const struct icst525_
 			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_p
 			break;
 	} while (i < ARRAY_SIZE(idx2s));
 
-	if (i > ARRAY_SIZE(idx2s))
+	if (i >= ARRAY_SIZE(idx2s))
 		return vco;
 
 	vco.s = idx2s[i];