From: "Darrick J. Wong" <djwong@kernel.org>
To: William Theesfeld <william@theesfeld.net>
Cc: Carlos Maiolino <cem@kernel.org>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: convert dquot iterator map allocation to kmalloc_array()
Date: Mon, 1 Jun 2026 22:14:44 -0700 [thread overview]
Message-ID: <20260602051444.GU6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260601191858.608270-1-william@theesfeld.net>
On Mon, Jun 01, 2026 at 03:18:57PM -0400, William Theesfeld wrote:
> Convert the open-coded kmalloc(n * sizeof(*p), ...) pattern in
> xfs_qm_dqiterate() to kmalloc_array(n, sizeof(*p), ...). This matches
> the convention adopted across fs/xfs/ in commit 910bbdf2f4dXX ("xfs:
> convert buf_cancel_table allocation to kmalloc_array") and is the only
> remaining instance of the old pattern in fs/xfs/.
>
> No functional change. XFS_DQITER_MAP_SIZE is a compile-time constant
> (10) so the runtime overflow check added by kmalloc_array() folds away;
> the conversion is for consistency and to keep fs/xfs/ free of the
> deprecated form.
>
> Signed-off-by: William Theesfeld <william@theesfeld.net>
Macros these days...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_qm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 7bd15d9e7..eebdeb181 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -1170,7 +1170,7 @@ xfs_qm_reset_dqcounts_buf(
> if (qip->i_nblocks == 0)
> return 0;
>
> - map = kmalloc(XFS_DQITER_MAP_SIZE * sizeof(*map),
> + map = kmalloc_array(XFS_DQITER_MAP_SIZE, sizeof(*map),
> GFP_KERNEL | __GFP_NOFAIL);
>
> lblkno = 0;
> --
> 2.54.0
>
>
next prev parent reply other threads:[~2026-06-02 5:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-01 19:18 William Theesfeld
2026-06-02 5:14 ` Darrick J. Wong [this message]
2026-06-02 5:56 ` Christoph Hellwig
2026-06-02 11:25 ` [PATCH v2] xfs: convert dquot iterator map allocation to kmalloc_objs() William Theesfeld
2026-06-02 14:01 ` Carlos Maiolino
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=20260602051444.GU6078@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=william@theesfeld.net \
/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
all inboxes | Powered by JetHome®