From: Thomas Meyer Date: Sat, 1 Jun 2013 09:40:31 +0000 (+0200) Subject: HID: hyperv: convert alloc+memcpy to memdup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a4a23f6d68ad2c86ee8df6a6f89c9d315c0a761c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git HID: hyperv: convert alloc+memcpy to memdup Signed-off-by: Thomas Meyer Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index aa3fec0d9dc6..713217380b44 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -199,13 +199,11 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device, if (desc->bLength == 0) goto cleanup; - input_device->hid_desc = kzalloc(desc->bLength, GFP_ATOMIC); + input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC); if (!input_device->hid_desc) goto cleanup; - memcpy(input_device->hid_desc, desc, desc->bLength); - input_device->report_desc_size = desc->desc[0].wDescriptorLength; if (input_device->report_desc_size == 0) { input_device->dev_info_status = -EINVAL;