Input: check keycodesize when adjusting keymaps
When changing key mappings we need to make sure that the new keycode value can be stored in dev->keycodesize bytes. Signed-off-by: Vojtech Pavlik <vojtech@suse.cz> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
committed by
Dmitry Torokhov
parent
463a4f76a7
commit
5ac7ba3ff5
@@ -198,10 +198,10 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
|
||||
|
||||
if (scancode >= dev->keycodemax)
|
||||
return -EINVAL;
|
||||
if (keycode > KEY_MAX)
|
||||
return -EINVAL;
|
||||
if (keycode < 0 || keycode > KEY_MAX)
|
||||
return -EINVAL;
|
||||
if (keycode >> (dev->keycodesize * 8))
|
||||
return -EINVAL;
|
||||
|
||||
oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);
|
||||
|
||||
|
Reference in New Issue
Block a user