aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2015-03-20 21:03:53 +0100
committerAnders Roxell <anders.roxell@linaro.org>2015-03-20 21:03:53 +0100
commite20e8b472345ea5babd805db6726d1a7000f7673 (patch)
tree1aaff25991578806a867ba3efcb0f7fd59940388 /drivers/input/evdev.c
parent588956edf5bb33741de41687677f21f5c37671da (diff)
parentc59ecb2edfc11b725a0fa4cb5420c4dbae482c17 (diff)
Merge tag 'v3.14.36-rt31-lno1' into linux-linaro-lsk-v3.14-rt
Linux 3.14.36-rt31 Signed-off-by: Anders Roxell <anders.roxell@linaro.org> Conflicts: arch/arm64/kernel/setup.c arch/x86/kernel/traps.c
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index ce953d895f5b..fb787c3e88d9 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -757,20 +757,23 @@ static int evdev_handle_set_keycode_v2(struct input_dev *dev, void __user *p)
*/
static int evdev_handle_get_val(struct evdev_client *client,
struct input_dev *dev, unsigned int type,
- unsigned long *bits, unsigned int max,
- unsigned int size, void __user *p, int compat)
+ unsigned long *bits, unsigned int maxbit,
+ unsigned int maxlen, void __user *p,
+ int compat)
{
int ret;
unsigned long *mem;
+ size_t len;
- mem = kmalloc(sizeof(unsigned long) * max, GFP_KERNEL);
+ len = BITS_TO_LONGS(maxbit) * sizeof(unsigned long);
+ mem = kmalloc(len, GFP_KERNEL);
if (!mem)
return -ENOMEM;
spin_lock_irq(&dev->event_lock);
spin_lock(&client->buffer_lock);
- memcpy(mem, bits, sizeof(unsigned long) * max);
+ memcpy(mem, bits, len);
spin_unlock(&dev->event_lock);
@@ -778,7 +781,7 @@ static int evdev_handle_get_val(struct evdev_client *client,
spin_unlock_irq(&client->buffer_lock);
- ret = bits_to_user(mem, max, size, p, compat);
+ ret = bits_to_user(mem, maxbit, maxlen, p, compat);
if (ret < 0)
evdev_queue_syn_dropped(client);