linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namjae Jeon <linkinjeon@kernel.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steve French <sfrench@samba.org>,
	Hyunchul Lee <hyc.lee@gmail.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-cifs@vger.kernel.org
Subject: Re: [PATCH] ksmbd: Remove a redundant zeroing of memory
Date: Wed, 23 Mar 2022 08:38:18 +0900	[thread overview]
Message-ID: <CAKYAXd9uGsASkCSuKS7NW0MsME2n9Bhk8Sf=L0_uvs1qXU1wLg@mail.gmail.com> (raw)
In-Reply-To: <f8f1f383c4533a91a6025b1db5827ed6aaab002f.1647980983.git.christophe.jaillet@wanadoo.fr>

2022-03-23 5:29 GMT+09:00, 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.
I prefer this. Could you update the patch ?

Thanks!
> ---
>  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
>
>

  parent reply	other threads:[~2022-03-22 23:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 20:29 [PATCH] ksmbd: Remove a redundant zeroing of memory Christophe JAILLET
2022-03-22 22:27 ` Hyunchul Lee
2022-03-22 23:38 ` Namjae Jeon [this message]
2022-03-23  6:51 ` Dan Carpenter
2022-03-23 12:21   ` Dan Carpenter

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='CAKYAXd9uGsASkCSuKS7NW0MsME2n9Bhk8Sf=L0_uvs1qXU1wLg@mail.gmail.com' \
    --to=linkinjeon@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=hyc.lee@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=sfrench@samba.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 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).