[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef1d002a0720ace0ed8dd79c2ac3c600@perches.com>
Date: Tue, 17 Aug 2021 16:12:08 -0700
From: Joe Perches <joe@...ches.com>
To: Kari Argillander <kari.argillander@...il.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 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.
Powered by blists - more mailing lists