diff mbox

HID: hyperv: Cocci spatch "memdup.spatch"

Message ID 1370079631.29224.9.camel@localhost.localdomain (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Thomas Meyer June 1, 2013, 9:40 a.m. UTC
Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
---



--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Jiri Kosina June 3, 2013, 11:34 a.m. UTC | #1
On Sat, 1 Jun 2013, Thomas Meyer wrote:

> Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> ---
> 
> diff -u -p a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> --- 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;
> 

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.
KY Srinivasan June 3, 2013, 2:14 p.m. UTC | #2
> -----Original Message-----
> From: Jiri Kosina [mailto:jkosina@suse.cz]
> Sent: Monday, June 03, 2013 7:35 AM
> To: Thomas Meyer
> Cc: KY Srinivasan; Haiyang Zhang; devel@linuxdriverproject.org; linux-
> input@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] HID: hyperv: Cocci spatch "memdup.spatch"
> 
> On Sat, 1 Jun 2013, Thomas Meyer wrote:
> 
> > Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
> > ---
> >
> > diff -u -p a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
> > --- 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;
> >
> 
> 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.

Thanks Jiri!

K. Y
> 
> --
> Jiri Kosina
> SUSE Labs
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff -u -p a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c
--- 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;