summaryrefslogtreecommitdiff
path: root/drivers/char/keyboard.c
diff options
context:
space:
mode:
authorIan Campbell <ijc@hellion.org.uk>2005-09-04 01:41:14 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2005-09-04 01:41:14 -0500
commit4cee99564db7f65a6f88e4b752da52768cde3802 (patch)
tree6c355494c3c399d2c1fc2d746171f434ded907e4 /drivers/char/keyboard.c
parentd2b5ffca73594e4046f405e3ef2438ce41f76fb2 (diff)
Input: fix checking whether new keycode fits size-wise
When dev->keycodesize == sizeof(int) the old code produces incorrect result. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/char/keyboard.c')
-rw-r--r--drivers/char/keyboard.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c
index 523fd3c8bbaa..1ddaabeb8ef8 100644
--- a/drivers/char/keyboard.c
+++ b/drivers/char/keyboard.c
@@ -200,7 +200,7 @@ int setkeycode(unsigned int scancode, unsigned int keycode)
return -EINVAL;
if (keycode < 0 || keycode > KEY_MAX)
return -EINVAL;
- if (keycode >> (dev->keycodesize * 8))
+ if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
return -EINVAL;
oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);