Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: evdev - get rid of old workaround for EVIOCGBIT

We put this workaround in 2008 and the offending userspace has been fixed
up long time ago; the link in the message is no longer valid either, so it
is time to retire it.

Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

-18
-18
drivers/input/evdev.c
··· 629 629 return copy_to_user(p, str, len) ? -EFAULT : len; 630 630 } 631 631 632 - #define OLD_KEY_MAX 0x1ff 633 632 static int handle_eviocgbit(struct input_dev *dev, 634 633 unsigned int type, unsigned int size, 635 634 void __user *p, int compat_mode) 636 635 { 637 - static unsigned long keymax_warn_time; 638 636 unsigned long *bits; 639 637 int len; 640 638 ··· 650 652 default: return -EINVAL; 651 653 } 652 654 653 - /* 654 - * Work around bugs in userspace programs that like to do 655 - * EVIOCGBIT(EV_KEY, KEY_MAX) and not realize that 'len' 656 - * should be in bytes, not in bits. 657 - */ 658 - if (type == EV_KEY && size == OLD_KEY_MAX) { 659 - len = OLD_KEY_MAX; 660 - if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000)) 661 - pr_warning("(EVIOCGBIT): Suspicious buffer size %u, " 662 - "limiting output to %zu bytes. See " 663 - "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n", 664 - OLD_KEY_MAX, 665 - BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long)); 666 - } 667 - 668 655 return bits_to_user(bits, len, size, p, compat_mode); 669 656 } 670 - #undef OLD_KEY_MAX 671 657 672 658 static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p) 673 659 {