[PATCH] xfs: convert dquot iterator map allocation to kmalloc_array()

From: William Theesfeld

Date: Mon Jun 01 2026 - 15:23:05 EST


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@xxxxxxxxxxxxx>
---
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