lkml.org 
[lkml]   [2005]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[2.6 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>

--- linux-2.6.12-rc1-mm1-full/drivers/input/keyboard/atkbd.c.old 2005-03-24 02:46:57.000000000 +0100
+++ linux-2.6.12-rc1-mm1-full/drivers/input/keyboard/atkbd.c 2005-03-24 02:47:24.000000000 +0100
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-04-06 13:30    [from the cache]
©2003-2011 Jasper Spaans