linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Potter <phil@philpotter.co.uk>
To: Saurav Girepunje <saurav.girepunje@gmail.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Greg KH <gregkh@linuxfoundation.org>,
	Michael Straube <straube.linux@gmail.com>,
	Martin Kaiser <martin@kaiser.cx>,
	"open list:STAGING SUBSYSTEM" <linux-staging@lists.linux.dev>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	saurav.girepunje@hotmail.com
Subject: Re: [PATCH] staging: r8188eu: os_dep: use kmemdup instead of kzalloc and memcpy
Date: Fri, 3 Sep 2021 19:53:29 +0100	[thread overview]
Message-ID: <CAA=Fs0mP7xqiS7+EX+J5MYH-AkEN_5SgtLrxAd669kXHG7Jk+A@mail.gmail.com> (raw)
In-Reply-To: <YTJhwQstKPUYRwN+@user>

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

  reply	other threads:[~2021-09-03 18:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA=Fs0mP7xqiS7+EX+J5MYH-AkEN_5SgtLrxAd669kXHG7Jk+A@mail.gmail.com' \
    --to=phil@philpotter.co.uk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=martin@kaiser.cx \
    --cc=saurav.girepunje@gmail.com \
    --cc=saurav.girepunje@hotmail.com \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).