提交 741d98c7 编写于 作者: D Dan Carpenter 提交者: Darren Hart

thinkpad_acpi: off by one in adaptive_keyboard_hotkey_notify_hotkey()

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: 6a68d855 ('thinkpad_acpi: Add support for more adaptive kbd buttons')
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Acked-By: NBastien Nocera <hadess@hadess.net>
Acked-by: NHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: NDarren Hart <dvhart@linux.intel.com>
上级 abf9dc0d
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册