lm8333: Fix check ordering
authorAlan Cox <alan@linux.intel.com>
Wed, 27 Jun 2012 11:02:07 +0000 (12:02 +0100)
committerJiri Kosina <jkosina@suse.cz>
Wed, 27 Jun 2012 15:35:55 +0000 (17:35 +0200)
Fix harmless reference off end of array

Reported-by: <dcb314@hotmail.com>
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?43861
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/input/keyboard/lm8333.c

index ca168a6679deea0ada4cccf6cc48b3f40a3ce9b0..081fd9effa8c286c68dc89e700e9fcc01663889f 100644 (file)
@@ -91,7 +91,7 @@ static void lm8333_key_handler(struct lm8333 *lm8333)
                return;
        }
 
-       for (i = 0; keys[i] && i < LM8333_FIFO_TRANSFER_SIZE; i++) {
+       for (i = 0; i < LM8333_FIFO_TRANSFER_SIZE && keys[i]; i++) {
                pressed = keys[i] & 0x80;
                code = keys[i] & 0x7f;