lkml.org 
[lkml]   [2022]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] ksmbd: Remove a redundant zeroing of memory
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>

2022년 3월 23일 (수) 오전 5:29, Christophe JAILLET
<christophe.jaillet@wanadoo.fr>님이 작성:
>
> fill_transform_hdr() already call memset(0) on its 1st argument, so there
> is no need to clear it explicitly before calling this function.
>
> Use kmalloc() instead of kzalloc() to save a few cycles.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Alternatively, fill_transform_hdr() has only one caller. So its memset()
> could be removed instead and this kzalloc() left as is.
> ---
> fs/ksmbd/smb2pdu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
> index bcb98109bac9..0e4f819e5859 100644
> --- a/fs/ksmbd/smb2pdu.c
> +++ b/fs/ksmbd/smb2pdu.c
> @@ -8434,7 +8434,7 @@ int smb3_encrypt_resp(struct ksmbd_work *work)
> if (ARRAY_SIZE(iov) < rq_nvec)
> return -ENOMEM;
>
> - work->tr_buf = kzalloc(sizeof(struct smb2_transform_hdr) + 4, GFP_KERNEL);
> + work->tr_buf = kmalloc(sizeof(struct smb2_transform_hdr) + 4, GFP_KERNEL);
> if (!work->tr_buf)
> return rc;
>
> --
> 2.32.0
>


--
Thanks,
Hyunchul

\
 
 \ /
  Last update: 2022-03-22 23:28    [W:0.070 / U:0.508 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site