All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namjae Jeon <namjae.jeon@samsung.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] cifsd: fix memdup.cocci warnings
Date: Fri, 02 Apr 2021 12:21:07 +0900	[thread overview]
Message-ID: <00a201d7276f$38ce5b60$aa6b1220$@samsung.com> (raw)
In-Reply-To: <20210401210048.GA8559@9f101362a1e3>

[-- Attachment #1: Type: text/plain, Size: 1368 bytes --]

Hi,

I will apply it.
Thanks for your patch.

> 
> From: kernel test robot <lkp@intel.com>
> 
> fs/cifsd/smb2pdu.c:1177:27-34: WARNING opportunity for kmemdup
> 
>  Use kmemdup rather than duplicating its implementation
> 
> Generated by: scripts/coccinelle/api/memdup.cocci
> 
> Fixes: 5dfeb6d945e5 ("cifsd: use kmalloc() for small allocations")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> ---
> 
> tree:   git://github.com/smfrench/smb3-kernel.git pr/35
> head:   4be6ba679c5175935a9132b87148d215a69cec16
> commit: 5dfeb6d945e5548e5fc31f2188aaa90467b4d55d [28/35] cifsd: use kmalloc() for small allocations
> 
>  smb2pdu.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> --- a/fs/cifsd/smb2pdu.c
> +++ b/fs/cifsd/smb2pdu.c
> @@ -1174,13 +1174,11 @@ static int alloc_preauth_hash(struct ksm
>  	if (sess->Preauth_HashValue)
>  		return 0;
> 
> -	sess->Preauth_HashValue = kmalloc(PREAUTH_HASHVALUE_SIZE, GFP_KERNEL);
> +	sess->Preauth_HashValue = kmemdup(conn->preauth_info->Preauth_HashValue,
> +					  PREAUTH_HASHVALUE_SIZE, GFP_KERNEL);
>  	if (!sess->Preauth_HashValue)
>  		return -ENOMEM;
> 
> -	memcpy(sess->Preauth_HashValue,
> -	       conn->preauth_info->Preauth_HashValue,
> -	       PREAUTH_HASHVALUE_SIZE);
>  	return 0;
>  }
> 

      reply	other threads:[~2021-04-02  3:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 21:00 [smfrench-smb3-kernel:pr/35 28/35] fs/cifsd/smb2pdu.c:1177:27-34: WARNING opportunity for kmemdup kernel test robot
2021-04-01 21:00 ` [PATCH] cifsd: fix memdup.cocci warnings kernel test robot
2021-04-02  3:21   ` Namjae Jeon [this message]

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='00a201d7276f$38ce5b60$aa6b1220$@samsung.com' \
    --to=namjae.jeon@samsung.com \
    --cc=kbuild-all@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.