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: <20210817234359.o3cotsqpy2cg67pu@kari-VirtualBox>
Date:   Wed, 18 Aug 2021 02:43:59 +0300
From:   Kari Argillander <kari.argillander@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Konstantin Komarov <almaz.alexandrovich@...agon-software.com>,
        ntfs3@...ts.linux.dev, Christoph Hellwig <hch@....de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] fs/ntfs3: Use kcalloc/kmalloc_array over
 kzalloc/kmalloc

On Tue, Aug 17, 2021 at 04:12:08PM -0700, Joe Perches wrote:
> On 2021-08-17 12:38, Kari Argillander wrote:
> > Use kcalloc/kmalloc_array over kzalloc/kmalloc when we allocate array.
> > Checkpatch found these after we did not use our own defined allocation
> > wrappers.
> []
> > diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> []
> > @@ -900,7 +900,7 @@ static ssize_t ntfs_compress_write(struct kiocb
> > *iocb, struct iov_iter *from)
> >  		return -EOPNOTSUPP;
> >  	}
> > 
> > -	pages = kmalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS);
> > +	pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS);
> 
> This is not an exact transformation.
> This allocates zeroed memory.
> Use kmalloc_array here instead.

Yeah. Thank you so much. I actually use kmalloc_array, but mistakes were
made and this was result. Thank you for reviewing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ