linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
@ 2021-09-03 17:56 Saurav Girepunje
  2021-09-03 18:53 ` Phillip Potter
  0 siblings, 1 reply; 7+ messages in thread
From: Saurav Girepunje @ 2021-09-03 17:56 UTC (permalink / raw)
  To: Larry.Finger, phil, gregkh, straube.linux, martin, linux-staging,
	linux-kernel
  Cc: saurav.girepunje

Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 81d4255d1785..495fadd2b8c8 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
 	}

 	if (ielen) {
-		buf = kzalloc(ielen, GFP_KERNEL);
+		buf = kmemdup(pie, ielen, GFP_KERNEL);
 		if (!buf) {
 			ret =  -ENOMEM;
 			goto exit;
 		}

-		memcpy(buf, pie, ielen);
-
 		/* dump */
 		{
 			int i;
--
2.32.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
  2021-09-03 17:56 [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy Saurav Girepunje
@ 2021-09-03 18:53 ` Phillip Potter
  2021-09-04  9:40   ` Saurav Girepunje
  0 siblings, 1 reply; 7+ messages in thread
From: Phillip Potter @ 2021-09-03 18:53 UTC (permalink / raw)
  To: Saurav Girepunje
  Cc: Larry Finger, Greg KH, Michael Straube, Martin Kaiser,
	open list:STAGING SUBSYSTEM, Linux Kernel Mailing List,
	saurav.girepunje

On Fri, 3 Sept 2021 at 18:56, Saurav Girepunje
<saurav.girepunje@gmail.com> wrote:
>
> Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c
>
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> index 81d4255d1785..495fadd2b8c8 100644
> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> @@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
>         }
>
>         if (ielen) {
> -               buf = kzalloc(ielen, GFP_KERNEL);
> +               buf = kmemdup(pie, ielen, GFP_KERNEL);
>                 if (!buf) {
>                         ret =  -ENOMEM;
>                         goto exit;
>                 }
>
> -               memcpy(buf, pie, ielen);
> -
>                 /* dump */
>                 {
>                         int i;
> --
> 2.32.0
>

Dear Saurav,

Looks good, thanks:
Acked-by: Phillip Potter <phil@philpotter.co.uk>

Regards,
Phil

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
  2021-09-03 18:53 ` Phillip Potter
@ 2021-09-04  9:40   ` Saurav Girepunje
  0 siblings, 0 replies; 7+ messages in thread
From: Saurav Girepunje @ 2021-09-04  9:40 UTC (permalink / raw)
  To: Phillip Potter
  Cc: saurav.girepunje, Larry Finger, Greg KH, Michael Straube,
	Martin Kaiser, open list:STAGING SUBSYSTEM,
	Linux Kernel Mailing List



On 04/09/21 12:23 am, Phillip Potter wrote:
> On Fri, 3 Sept 2021 at 18:56, Saurav Girepunje
> <saurav.girepunje@gmail.com> wrote:
>>
>> Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c
>>
>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>> ---
>>   drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
>> index 81d4255d1785..495fadd2b8c8 100644
>> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
>> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
>> @@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
>>          }
>>
>>          if (ielen) {
>> -               buf = kzalloc(ielen, GFP_KERNEL);
>> +               buf = kmemdup(pie, ielen, GFP_KERNEL);
>>                  if (!buf) {
>>                          ret =  -ENOMEM;
>>                          goto exit;
>>                  }
>>
>> -               memcpy(buf, pie, ielen);
>> -
>>                  /* dump */
>>                  {
>>                          int i;
>> --
>> 2.32.0
>>
> 
> Dear Saurav,
> 
> Looks good, thanks:
> Acked-by: Phillip Potter <phil@philpotter.co.uk>
> 
> Regards,
> Phil
> 

Thanks for review Phil

Regards,
Saurav Girepunje

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
  2021-09-03 17:48   ` SAURAV GIREPUNJE
@ 2021-09-04  4:51     ` Saurav Girepunje
  0 siblings, 0 replies; 7+ messages in thread
From: Saurav Girepunje @ 2021-09-04  4:51 UTC (permalink / raw)
  To: Greg KH
  Cc: Larry.Finger, phil, straube.linux, martin, linux-staging,
	linux-kernel, saurav.girepunje



On 03/09/21 11:18 pm, SAURAV GIREPUNJE wrote:
> On 02 Sep 2021 11:20, Greg KH wrote:
>> On Sat, Aug 28, 2021 at 11:47:51PM +0530, Saurav Girepunje wrote:
>>> Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c
>>>
>>> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
>>> ---
>>>   drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
>>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
>>> index 81d4255d1785..495fadd2b8c8 100644
>>> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
>>> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
>>> @@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
>>>   	}
>>>
>>>   	if (ielen) {
>>> -		buf = kzalloc(ielen, GFP_KERNEL);
>>> +		buf = kmemdup(pie, ielen, GFP_KERNEL);
>>>   		if (!buf) {
>>>   			ret =  -ENOMEM;
>>>   			goto exit;
>>>   		}
>>>
>>> -		memcpy(buf, pie, ielen);
>>> -
>>>   		/* dump */
>>>   		{
>>>   			int i;
>>> --
>>> 2.32.0
>>>
>>>
>>
>> This patch never showed up on lore.kernel.org for some reason.  Please
>> resend and see if it was a mailing issue on your side...
>>
>> thanks,
>>
>> greg k-h
> 
> 
> Ok, I will resend this patch.
> 
> Thanks,
> Saurav Girepunje
> 

Hi Greg,

I have resend the patch, But the last patch also on lore.kernel.org
https://lore.kernel.org/all/YSp9z2%2FJmvHGhW5m@user/

Regards,
Saurav Girepunje

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
  2021-09-02  9:20 ` Greg KH
@ 2021-09-03 17:48   ` SAURAV GIREPUNJE
  2021-09-04  4:51     ` Saurav Girepunje
  0 siblings, 1 reply; 7+ messages in thread
From: SAURAV GIREPUNJE @ 2021-09-03 17:48 UTC (permalink / raw)
  To: Greg KH
  Cc: Larry.Finger, phil, straube.linux, martin, linux-staging,
	linux-kernel, saurav.girepunje

On 02 Sep 2021 11:20, Greg KH wrote:
> On Sat, Aug 28, 2021 at 11:47:51PM +0530, Saurav Girepunje wrote:
> > Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c
> >
> > Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> > ---
> >  drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> > index 81d4255d1785..495fadd2b8c8 100644
> > --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> > @@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
> >  	}
> >
> >  	if (ielen) {
> > -		buf = kzalloc(ielen, GFP_KERNEL);
> > +		buf = kmemdup(pie, ielen, GFP_KERNEL);
> >  		if (!buf) {
> >  			ret =  -ENOMEM;
> >  			goto exit;
> >  		}
> >
> > -		memcpy(buf, pie, ielen);
> > -
> >  		/* dump */
> >  		{
> >  			int i;
> > --
> > 2.32.0
> >
> >
>
> This patch never showed up on lore.kernel.org for some reason.  Please
> resend and see if it was a mailing issue on your side...
>
> thanks,
>
> greg k-h


Ok, I will resend this patch.

Thanks,
Saurav Girepunje

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
  2021-08-28 18:17 Saurav Girepunje
@ 2021-09-02  9:20 ` Greg KH
  2021-09-03 17:48   ` SAURAV GIREPUNJE
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2021-09-02  9:20 UTC (permalink / raw)
  To: Saurav Girepunje
  Cc: Larry.Finger, phil, straube.linux, martin, linux-staging,
	linux-kernel, saurav.girepunje

On Sat, Aug 28, 2021 at 11:47:51PM +0530, Saurav Girepunje wrote:
> Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c
> 
> Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
> ---
>  drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> index 81d4255d1785..495fadd2b8c8 100644
> --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
> @@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
>  	}
> 
>  	if (ielen) {
> -		buf = kzalloc(ielen, GFP_KERNEL);
> +		buf = kmemdup(pie, ielen, GFP_KERNEL);
>  		if (!buf) {
>  			ret =  -ENOMEM;
>  			goto exit;
>  		}
> 
> -		memcpy(buf, pie, ielen);
> -
>  		/* dump */
>  		{
>  			int i;
> --
> 2.32.0
> 
> 

This patch never showed up on lore.kernel.org for some reason.  Please
resend and see if it was a mailing issue on your side...

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
@ 2021-08-28 18:17 Saurav Girepunje
  2021-09-02  9:20 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Saurav Girepunje @ 2021-08-28 18:17 UTC (permalink / raw)
  To: Larry.Finger, phil, gregkh, straube.linux, martin, linux-staging,
	linux-kernel
  Cc: saurav.girepunje

Fixes coccicheck warning:WARNING opportunity for kmemdup in ioctl_linux.c

Signed-off-by: Saurav Girepunje <saurav.girepunje@gmail.com>
---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
index 81d4255d1785..495fadd2b8c8 100644
--- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c
@@ -585,14 +585,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
 	}

 	if (ielen) {
-		buf = kzalloc(ielen, GFP_KERNEL);
+		buf = kmemdup(pie, ielen, GFP_KERNEL);
 		if (!buf) {
 			ret =  -ENOMEM;
 			goto exit;
 		}

-		memcpy(buf, pie, ielen);
-
 		/* dump */
 		{
 			int i;
--
2.32.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-04  9:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 17:56 [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy Saurav Girepunje
2021-09-03 18:53 ` Phillip Potter
2021-09-04  9:40   ` Saurav Girepunje
  -- strict thread matches above, loose matches on Subject: below --
2021-08-28 18:17 Saurav Girepunje
2021-09-02  9:20 ` Greg KH
2021-09-03 17:48   ` SAURAV GIREPUNJE
2021-09-04  4:51     ` Saurav Girepunje

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).