All of lore.kernel.org
 help / color / mirror / Atom feed
* [smfrench-smb3-kernel:pr/35 28/35] fs/cifsd/smb2pdu.c:1177:27-34: WARNING opportunity for kmemdup
@ 2021-04-01 21:00 kernel test robot
  2021-04-01 21:00 ` [PATCH] cifsd: fix memdup.cocci warnings kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-04-01 21:00 UTC (permalink / raw)
  To: kbuild-all

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

tree:   git://github.com/smfrench/smb3-kernel.git pr/35
head:   4be6ba679c5175935a9132b87148d215a69cec16
commit: 5dfeb6d945e5548e5fc31f2188aaa90467b4d55d [28/35] cifsd: use kmalloc() for small allocations
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cocci warnings: (new ones prefixed by >>)
>> fs/cifsd/smb2pdu.c:1177:27-34: WARNING opportunity for kmemdup

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 66038 bytes --]

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

* [PATCH] cifsd: fix memdup.cocci warnings
  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 ` kernel test robot
  2021-04-02  3:21   ` Namjae Jeon
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2021-04-01 21:00 UTC (permalink / raw)
  To: kbuild-all

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

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;
 }
 

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

* Re: [PATCH] cifsd: fix memdup.cocci warnings
  2021-04-01 21:00 ` [PATCH] cifsd: fix memdup.cocci warnings kernel test robot
@ 2021-04-02  3:21   ` Namjae Jeon
  0 siblings, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2021-04-02  3:21 UTC (permalink / raw)
  To: kbuild-all

[-- 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;
>  }
> 

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

end of thread, other threads:[~2021-04-02  3:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.