fs/xfs/xfs_qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Using kmalloc_array() better reflects the intent to allocate an array of
map entries, and improves consistency with similar allocations across the
kernel.
No functional change intended.
Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com>
---
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 23ba84ec919a..34ec61e455ff 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1218,7 +1218,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.34.1
On Sat, Oct 18, 2025 at 07:45:28PM +0000, Kriish Sharma wrote: > Using kmalloc_array() better reflects the intent to allocate an array of > map entries, and improves consistency with similar allocations across the > kernel. > > No functional change intended. > > Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com> > --- > 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 23ba84ec919a..34ec61e455ff 100644 > --- a/fs/xfs/xfs_qm.c > +++ b/fs/xfs/xfs_qm.c > @@ -1218,7 +1218,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), Why would we replace a constant that can be computed at compile time with a dynamic computation that is now fallible despite NOFAIL? --D > GFP_KERNEL | __GFP_NOFAIL); > > lblkno = 0; > -- > 2.34.1 > >
Hello. On Sat, Oct 18, 2025 at 07:45:28PM +0000, Kriish Sharma wrote: > Using kmalloc_array() better reflects the intent to allocate an array of > map entries, and improves consistency with similar allocations across the > kernel. > > No functional change intended. Thanks for the patch. Have you ran xfstests against this patch? All patches sent to xfs should at least pass basic testing via xfstests. I.e. ensure there is no new failure between an unpatched kernel and a kernel with your patch. If you did, please send me the results summary, if you did not, please run it, and send a V2 of this patch including in the patch description the summary of the results. Any changes includes risk, and so every patch sent to xfs should be at least basically tested against xfstests auto group. Thanks, Carlos > > Signed-off-by: Kriish Sharma <kriish.sharma2006@gmail.com> > --- > 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 23ba84ec919a..34ec61e455ff 100644 > --- a/fs/xfs/xfs_qm.c > +++ b/fs/xfs/xfs_qm.c > @@ -1218,7 +1218,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.34.1 >
© 2016 - 2026 Red Hat, Inc.