Skip to content

Commit

Permalink
HID: hyperv: convert alloc+memcpy to memdup
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Thomas Meyer authored and Jiri Kosina committed Jun 3, 2013
1 parent b1a1442 commit a4a23f6
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/hid/hid-hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a4a23f6

Please sign in to comment.