Skip to content

Commit

Permalink
thinkpad_acpi: off by one in adaptive_keyboard_hotkey_notify_hotkey()
Browse files Browse the repository at this point in the history
This should be >= instead of > because otherwise we read one element
past the end of the hotkey_keycode_map[] array.

The hotkey_keycode_map[] array has TPACPI_HOTKEY_MAP_LEN elements.

Fixes: 6a68d85 ('thinkpad_acpi: Add support for more adaptive kbd buttons')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-By: Bastien Nocera <hadess@hadess.net>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
  • Loading branch information
Dan Carpenter authored and Darren Hart committed Mar 14, 2015
1 parent abf9dc0 commit 741d98c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3656,8 +3656,9 @@ static bool adaptive_keyboard_hotkey_notify_hotkey(unsigned int scancode)
return true;

default:
if (scancode < FIRST_ADAPTIVE_KEY || scancode > FIRST_ADAPTIVE_KEY +
TPACPI_HOTKEY_MAP_LEN - ADAPTIVE_KEY_OFFSET) {
if (scancode < FIRST_ADAPTIVE_KEY ||
scancode >= FIRST_ADAPTIVE_KEY + TPACPI_HOTKEY_MAP_LEN -
ADAPTIVE_KEY_OFFSET) {
pr_info("Unhandled adaptive keyboard key: 0x%x\n",
scancode);
return false;
Expand Down

0 comments on commit 741d98c

Please sign in to comment.