aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorIan Campbell <ijc@hellion.org.uk>2005-09-04 02:41:14 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-09-04 02:41:14 -0400
commit4cee99564db7f65a6f88e4b752da52768cde3802 (patch)
tree6c355494c3c399d2c1fc2d746171f434ded907e4 /drivers/char
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')
-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)
200 return -EINVAL; 200 return -EINVAL;
201 if (keycode < 0 || keycode > KEY_MAX) 201 if (keycode < 0 || keycode > KEY_MAX)
202 return -EINVAL; 202 return -EINVAL;
203 if (keycode >> (dev->keycodesize * 8)) 203 if (dev->keycodesize < sizeof(keycode) && (keycode >> (dev->keycodesize * 8)))
204 return -EINVAL; 204 return -EINVAL;
205 205
206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); 206 oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode);