diff options
author | Ian Campbell <ijc@hellion.org.uk> | 2005-09-04 02:41:14 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor_core@ameritech.net> | 2005-09-04 02:41:14 -0400 |
commit | 4cee99564db7f65a6f88e4b752da52768cde3802 (patch) | |
tree | 6c355494c3c399d2c1fc2d746171f434ded907e4 /drivers/input/evdev.c | |
parent | d2b5ffca73594e4046f405e3ef2438ce41f76fb2 (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/input/evdev.c')
-rw-r--r-- | drivers/input/evdev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 20e3a165989f..3a8314bb7902 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -320,7 +320,7 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
320 | if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; | 320 | if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; |
321 | if (get_user(v, ip + 1)) return -EFAULT; | 321 | if (get_user(v, ip + 1)) return -EFAULT; |
322 | if (v < 0 || v > KEY_MAX) return -EINVAL; | 322 | if (v < 0 || v > KEY_MAX) return -EINVAL; |
323 | if (v >> (dev->keycodesize * 8)) return -EINVAL; | 323 | if (dev->keycodesize < sizeof(v) && (v >> (dev->keycodesize * 8))) return -EINVAL; |
324 | u = SET_INPUT_KEYCODE(dev, t, v); | 324 | u = SET_INPUT_KEYCODE(dev, t, v); |
325 | clear_bit(u, dev->keybit); | 325 | clear_bit(u, dev->keybit); |
326 | set_bit(v, dev->keybit); | 326 | set_bit(v, dev->keybit); |