From 5ac7ba3ff599d66ffde182676f2e4fbcac61a2fe Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Sun, 24 Jul 2005 00:50:03 -0500 Subject: 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 Signed-off-by: Dmitry Torokhov --- drivers/input/evdev.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/input') diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 374f404e81d..20e3a165989 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) if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; if (get_user(v, ip + 1)) return -EFAULT; if (v < 0 || v > KEY_MAX) return -EINVAL; + if (v >> (dev->keycodesize * 8)) return -EINVAL; u = SET_INPUT_KEYCODE(dev, t, v); clear_bit(u, dev->keybit); set_bit(v, dev->keybit); -- cgit v1.2.3