lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220323122113.GC336@kadam>
Date:   Wed, 23 Mar 2022 15:21:13 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     Namjae Jeon <linkinjeon@...nel.org>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steve French <sfrench@...ba.org>,
        Hyunchul Lee <hyc.lee@...il.com>, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org, linux-cifs@...r.kernel.org
Subject: Re: [PATCH] ksmbd: Remove a redundant zeroing of memory

On Wed, Mar 23, 2022 at 09:51:11AM +0300, Dan Carpenter wrote:
> On Tue, Mar 22, 2022 at 09:29:51PM +0100, Christophe JAILLET wrote:
> > 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@...adoo.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);
>                                                                  ^^^
> fill_transform_hdr() does not clear the last 4 bytes.
> 

Oops.  I was looking at the wrong fill_transform_hdr() from smb2ops.c
instead of smb2pdu.c.  Sorry!

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ