Skip to contentSkip to conversation

HID: hyperv: Cocci spatch "memdup.spatch"

PATCH In review Thomas Meyer 3 participants 3 messages Jun 1, 2013 – Jun 3, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: hyperv: Cocci spatch "memdup.spatch"

---

drivers/hid/hid-hyperv.c +1 -3
diff -u -p a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
@@ -199,13 +199,11 @@ static void mousevsc_on_receive_device_i
 	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;
#1 lore raw
Quoted 12 lines · Thomas Meyer

---

diff -u -p a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c

drivers/hid/hid-hyperv.c +0 -1
@@ -199,13 +199,11 @@ static void mousevsc_on_receive_device_i
 	if (desc->bLength == 0)
 		goto cleanup;
 
-	input_device->hid_desc = kzalloc(desc->bLength, GFP_ATOMIC);

drivers/hid/hid-hyperv.c static void mousevsc_on_receive_device_i · line 209

Quoted 10 lines
drivers/hid/hid-hyperv.c +1 -2
+	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;

I guess you are going to get some pushback from some maintainers due to non-descriptive subject and missing changelog :)

I have fixed this for the hyperv patch and applied it, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs
#2 lore raw
Quoted 39 lines

-----Original Message-----
From: Jiri Kosina [mailto:[email protected]]
Sent: Monday, June 03, 2013 7:35 AM
To: Thomas Meyer
Cc: KY Srinivasan; Haiyang Zhang; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] HID: hyperv: Cocci spatch "memdup.spatch"

drivers/hid/hid-hyperv.c static void mousevsc_on_receive_device_i · line 202

Quoted 12 lines · Thomas Meyer

---

diff -u -p a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c

drivers/hid/hid-hyperv.c +1 -1
@@ -199,13 +199,11 @@ static void mousevsc_on_receive_device_i
 	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);

drivers/hid/hid-hyperv.c static void mousevsc_on_receive_device_i

Quoted 10 lines
drivers/hid/hid-hyperv.c +0 -2
 	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;
 

I guess you are going to get some pushback from some maintainers due to non-descriptive subject and missing changelog :)

Quoted 1 line

I have fixed this for the hyperv patch and applied it, thanks.

Thanks Jiri!

K. Y

Quoted 5 lines

--
Jiri Kosina
SUSE Labs