Commit d0f0a160 authored by Dmitry Torokhov's avatar Dmitry Torokhov

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: default avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 062589b1
...@@ -629,12 +629,10 @@ static int str_to_user(const char *str, unsigned int maxlen, void __user *p) ...@@ -629,12 +629,10 @@ static int str_to_user(const char *str, unsigned int maxlen, void __user *p)
return copy_to_user(p, str, len) ? -EFAULT : len; return copy_to_user(p, str, len) ? -EFAULT : len;
} }
#define OLD_KEY_MAX 0x1ff
static int handle_eviocgbit(struct input_dev *dev, static int handle_eviocgbit(struct input_dev *dev,
unsigned int type, unsigned int size, unsigned int type, unsigned int size,
void __user *p, int compat_mode) void __user *p, int compat_mode)
{ {
static unsigned long keymax_warn_time;
unsigned long *bits; unsigned long *bits;
int len; int len;
...@@ -652,24 +650,8 @@ static int handle_eviocgbit(struct input_dev *dev, ...@@ -652,24 +650,8 @@ static int handle_eviocgbit(struct input_dev *dev,
default: return -EINVAL; default: return -EINVAL;
} }
/*
* Work around bugs in userspace programs that like to do
* EVIOCGBIT(EV_KEY, KEY_MAX) and not realize that 'len'
* should be in bytes, not in bits.
*/
if (type == EV_KEY && size == OLD_KEY_MAX) {
len = OLD_KEY_MAX;
if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000))
pr_warning("(EVIOCGBIT): Suspicious buffer size %u, "
"limiting output to %zu bytes. See "
"http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
OLD_KEY_MAX,
BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
}
return bits_to_user(bits, len, size, p, compat_mode); return bits_to_user(bits, len, size, p, compat_mode);
} }
#undef OLD_KEY_MAX
static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p) static int evdev_handle_get_keycode(struct input_dev *dev, void __user *p)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment