HID: hyperv: convert alloc+memcpy to memdup
authorThomas Meyer <thomas@m3y3r.de>
Sat, 1 Jun 2013 09:40:31 +0000 (11:40 +0200)
committerJiri Kosina <jkosina@suse.cz>
Mon, 3 Jun 2013 11:32:22 +0000 (13:32 +0200)
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-hyperv.c

index aa3fec0..7132173 100644 (file)
@@ -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;