summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorVojtech Pavlik <vojtech@suse.cz>2005-07-24 09:50:03 +0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-07-24 09:50:03 +0400
commit5ac7ba3ff599d66ffde182676f2e4fbcac61a2fe (patch)
tree5c8e25dc2797cb0e063c38afda2dbbf292e34bd3 /drivers/char
parent463a4f76a79bce00ca8964e0b2ebf7f10f376965 (diff)
downloadlinux-5ac7ba3ff599d66ffde182676f2e4fbcac61a2fe.tar.xz
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>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/keyboard.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 7b19e02f112f..523fd3c8bbaa 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -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);