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>
This commit is contained in:
Martin Roth
2017-08-07 16:29:44 -06:00
committed by chrome-bot
parent 1ba0395a18
commit 0e390e9867

View File

@@ -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)