From: "Darrick J. Wong" <djwong@kernel.org>
To: Cihan Karadag <cihan.cihan@gmail.com>
Cc: Carlos Maiolino <cem@kernel.org>, Shuah Khan <shuah@kernel.org>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: use kmalloc_array() instead of kmalloc() in xfs_da_grow_inode_int
Date: Tue, 14 Jul 2026 08:42:50 -0700 [thread overview]
Message-ID: <20260714154250.GC7380@frogsfrogsfrogs> (raw)
In-Reply-To: <20260714091912.239557-1-cihan.cihan@gmail.com>
On Tue, Jul 14, 2026 at 03:17:24AM -0600, Cihan Karadag wrote:
> Replace the open-coded
>
> sizeof(*mapp) * count
>
> multiplication with kmalloc_array(), based on kernel coding guidelines
> against open-coded arithmetic in allocator arguments.
>
> Signed-off-by: Cihan Karadag <cihan.cihan@gmail.com>
> ---
> fs/xfs/libxfs/xfs_da_btree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index 9debb95d86fa0..99e4318ba75f2 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -2354,7 +2354,7 @@ xfs_da_grow_inode_int(
> * If we didn't get it and the block might work if fragmented,
> * try without the CONTIG flag. Loop until we get it all.
> */
> - mapp = kmalloc(sizeof(*mapp) * count,
> + mapp = kmalloc_array(count, sizeof(*mapp),
> GFP_KERNEL | __GFP_NOFAIL);
kmalloc_objs?
--D
> for (b = *bno, mapi = 0; b < *bno + count; ) {
> c = (int)(*bno + count - b);
> --
> 2.54.0
>
>
prev parent reply other threads:[~2026-07-14 15:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 9:17 [PATCH] xfs: use kmalloc_array() instead of kmalloc() in xfs_da_grow_inode_int Cihan Karadag
2026-07-14 15:42 ` Darrick J. Wong [this message]
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=20260714154250.GC7380@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=cihan.cihan@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=shuah@kernel.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