summaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/atkbd.c
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@stusta.de>2005-05-17 06:53:38 +0200
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-17 16:59:17 +0200
commit53b21689ba567ad437e4d7917dd9da54a8d6fd5c (patch)
treec8cdaab37c1ac04fbf9a8baf01122a55f69ee741 /drivers/input/keyboard/atkbd.c
parent[PATCH] mm/nommu.c: try to fix __vmalloc (diff)
downloadlinux-53b21689ba567ad437e4d7917dd9da54a8d6fd5c.tar.xz
linux-53b21689ba567ad437e4d7917dd9da54a8d6fd5c.zip
[PATCH] 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). Signed-off-by: Adrian Bunk <bunk@stusta.de> Cc: Vojtech Pavlik <vojtech@suse.cz> Cc: Dmitry Torokhov <dtor_core@ameritech.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/input/keyboard/atkbd.c')
-rw-r--r--drivers/input/keyboard/atkbd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index ff66ed4ee2cd..79c332f16fc7 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -465,8 +465,10 @@ static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int co
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);