summaryrefslogtreecommitdiff
path: root/common/keyboard_8042.c
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2017-08-07 16:29:44 -0600
committerchrome-bot <chrome-bot@chromium.org>2017-08-12 22:58:43 -0700
commit0e390e98677cd60cb68c99f49d11606ba213aab3 (patch)
tree76b9860ed30ce5ef70e5d0ef7b59a65f5da2e514 /common/keyboard_8042.c
parent1ba0395a18c02dfbdc66f8b0f5fa930353b26705 (diff)
downloadchrome-ec-0e390e98677cd60cb68c99f49d11606ba213aab3.tar.gz
8042: Fix error condition
Since the scancode_setX arrays are defined with size [KEYBOARD_ROWS][KEYBOARD_COLS], if rows or columns are equal to either of those values, it would be accessing values outside of the array. BUG=b:64477774 TEST=Build Change-Id: I8a92d142b03281f2f4ad35eaba605b5a46df798d Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://chromium-review.googlesource.com/606452 Commit-Ready: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/keyboard_8042.c')
-rw-r--r--common/keyboard_8042.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/keyboard_8042.c b/common/keyboard_8042.c
index 03e0540f42..208b220659 100644
--- a/common/keyboard_8042.c
+++ b/common/keyboard_8042.c
@@ -313,7 +313,7 @@ static enum ec_error_list matrix_callback(int8_t row, int8_t col,
ASSERT(scan_code);
ASSERT(len);
- if (row > KEYBOARD_ROWS || col > KEYBOARD_COLS)
+ if (row >= KEYBOARD_ROWS || col >= KEYBOARD_COLS)
return EC_ERROR_INVAL;
if (pressed)