aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2014-04-23 12:56:33 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-05-14 19:39:46 -0400
commitd0f0a1601449ded5a7bcaf954f9c75e6fd9d5183 (patch)
treed075fb73470a20d087ca9eba4b68230b29607857 /drivers/input/evdev.c
parent062589b1399176a9c14bc68e16169f40439d658c (diff)
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>
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c18
1 files changed, 0 insertions, 18 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a06e12552886..4af24f1e91b1 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -629,12 +629,10 @@ static int str_to_user(const char *str, unsigned int maxlen, void __user *p)
629 return copy_to_user(p, str, len) ? -EFAULT : len; 629 return copy_to_user(p, str, len) ? -EFAULT : len;
630} 630}
631 631
632#define OLD_KEY_MAX 0x1ff
633static int handle_eviocgbit(struct input_dev *dev, 632static int handle_eviocgbit(struct input_dev *dev,
634 unsigned int type, unsigned int size, 633 unsigned int type, unsigned int size,
635 void __user *p, int compat_mode) 634 void __user *p, int compat_mode)
636{ 635{
637 static unsigned long keymax_warn_time;
638 unsigned long *bits; 636 unsigned long *bits;
639 int len; 637 int len;
640 638
@@ -652,24 +650,8 @@ static int handle_eviocgbit(struct input_dev *dev,
652 default: return -EINVAL; 650 default: return -EINVAL;
653 } 651 }
654 652
655 /*
656 * Work around bugs in userspace programs that like to do
657 * EVIOCGBIT(EV_KEY, KEY_MAX) and not realize that 'len'
658 * should be in bytes, not in bits.
659 */
660 if (type == EV_KEY && size == OLD_KEY_MAX) {
661 len = OLD_KEY_MAX;
662 if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000))
663 pr_warning("(EVIOCGBIT): Suspicious buffer size %u, "
664 "limiting output to %zu bytes. See "
665 "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
666 OLD_KEY_MAX,
667 BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
668 }
669
670 return bits_to_user(bits, len, size, p, compat_mode); 653 return bits_to_user(bits, len, size, p, compat_mode);
671} 654}
672#undef OLD_KEY_MAX
673 655
674static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p) 656static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p)
675{ 657{