Skip to contentSkip to conversation

drivers/input/keyboard/atkbd.c: fix off by one errors

PATCH New Adrian Bunk 1 participant 1 message May 13, 2005 Input drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/input/keyboard/atkbd.c: fix off by one errors

This patch fixes two possible off by one errors found by the Coverity checker (look at the period[i] and delay[j] in the two first unchanged lines).

---

This patch was already sent on:
- 24 Mar 2005

drivers/input/keyboard/atkbd.c renamed from drivers/input/keyboard/atkbd.c.old +2 -2
@@ -468,8 +468,8 @@ static int atkbd_event(struct input_dev 
 			if (atkbd->softrepeat) return 0;
 
 			i = j = 0;
-			while (i < 32 && period[i] < dev->rep[REP_PERIOD]) i++;
-			while (j < 4 && delay[j] < dev->rep[REP_DELAY]) j++;
+			while (i < 31 && period[i] < dev->rep[REP_PERIOD]) i++;
+			while (j < 3 && delay[j] < dev->rep[REP_DELAY]) j++;
 			dev->rep[REP_PERIOD] = period[i];
 			dev->rep[REP_DELAY] = delay[j];
 			param[0] = i | (j << 5);