diff options
-rw-r--r-- | drivers/char/keyboard.c | 4 | ||||
-rw-r--r-- | drivers/input/evdev.c | 1 |
2 files changed, 3 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) | |||
198 | 198 | ||
199 | if (scancode >= dev->keycodemax) | 199 | if (scancode >= dev->keycodemax) |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | if (keycode > KEY_MAX) | ||
202 | return -EINVAL; | ||
203 | if (keycode < 0 || keycode > KEY_MAX) | 201 | if (keycode < 0 || keycode > KEY_MAX) |
204 | return -EINVAL; | 202 | return -EINVAL; |
203 | if (keycode >> (dev->keycodesize * 8)) | ||
204 | return -EINVAL; | ||
205 | 205 | ||
206 | oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); | 206 | oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); |
207 | 207 | ||
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 374f404e81da..20e3a165989f 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -320,6 +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 | u = SET_INPUT_KEYCODE(dev, t, v); | 324 | u = SET_INPUT_KEYCODE(dev, t, v); |
324 | clear_bit(u, dev->keybit); | 325 | clear_bit(u, dev->keybit); |
325 | set_bit(v, dev->keybit); | 326 | set_bit(v, dev->keybit); |