summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-06-05 00:34:08 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-06-05 00:34:45 -0700
commit0b75f775288b90a83a8708a5af663a03d4bbc9ce (patch)
tree1b2ef9436eff1a7ed057ec362f8665f606c23eb7 /drivers/input
parent3a4b4aaa546fa3d57b2ea7f41234f7d2e328da3f (diff)
Input: pcf8574_keypad - fix off by one in pcf8574_kp_irq_handler()
If nextstate == ARRAY_SIZE(lp->btncode), then we read one past the end of the array on the next line. This fixes a smatch warning: drivers/input/misc/pcf8574_keypad.c +74 pcf8574_kp_irq_handler(8) error: buffer overflow 'lp->btncode' 17 <= 17 Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/misc/pcf8574_keypad.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
index 5c3ac4e0b055..376e54df4763 100644
--- a/drivers/input/misc/pcf8574_keypad.c
+++ b/drivers/input/misc/pcf8574_keypad.c
@@ -69,7 +69,7 @@ static irqreturn_t pcf8574_kp_irq_handler(int irq, void *dev_id)
unsigned char nextstate = read_state(lp);
if (lp->laststate != nextstate) {
- int key_down = nextstate <= ARRAY_SIZE(lp->btncode);
+ int key_down = nextstate < ARRAY_SIZE(lp->btncode);
unsigned short keycode = key_down ?
lp->btncode[nextstate] : lp->btncode[lp->laststate];