diff options
-rw-r--r-- | drivers/hid/uhid.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c index 0d078c32db4f..0cb92e347258 100644 --- a/drivers/hid/uhid.c +++ b/drivers/hid/uhid.c | |||
@@ -441,12 +441,11 @@ static int uhid_dev_create2(struct uhid_device *uhid, | |||
441 | if (uhid->rd_size <= 0 || uhid->rd_size > HID_MAX_DESCRIPTOR_SIZE) | 441 | if (uhid->rd_size <= 0 || uhid->rd_size > HID_MAX_DESCRIPTOR_SIZE) |
442 | return -EINVAL; | 442 | return -EINVAL; |
443 | 443 | ||
444 | uhid->rd_data = kmalloc(uhid->rd_size, GFP_KERNEL); | 444 | uhid->rd_data = kmemdup(ev->u.create2.rd_data, uhid->rd_size, |
445 | GFP_KERNEL); | ||
445 | if (!uhid->rd_data) | 446 | if (!uhid->rd_data) |
446 | return -ENOMEM; | 447 | return -ENOMEM; |
447 | 448 | ||
448 | memcpy(uhid->rd_data, ev->u.create2.rd_data, uhid->rd_size); | ||
449 | |||
450 | hid = hid_allocate_device(); | 449 | hid = hid_allocate_device(); |
451 | if (IS_ERR(hid)) { | 450 | if (IS_ERR(hid)) { |
452 | ret = PTR_ERR(hid); | 451 | ret = PTR_ERR(hid); |