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:
Vojtech Pavlik
2005-07-24 00:50:03 -05:00
committed by Dmitry Torokhov
parent 463a4f76a7
commit 5ac7ba3ff5
2 changed files with 3 additions and 2 deletions

View File

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