From: hongao Date: Mon, 23 Mar 2026 18:33:18 +0000 (-0700) Subject: xfs: Remove redundant NULL check after __GFP_NOFAIL X-Git-Tag: v7.0.0~61 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8a5e47ac698566a7eb7acec07f05732bbad3f5bd;p=xfsprogs-dev.git xfs: Remove redundant NULL check after __GFP_NOFAIL Source kernel commit: 281cb17787d4284a7790b9cbd80fded826ca7739 kzalloc() is called with __GFP_NOFAIL, so a NULL return is not expected. Drop the redundant !map check in xfs_dabuf_map(). Also switch the nirecs-sized allocation to kcalloc(). Signed-off-by: hongao Reviewed-by: Christoph Hellwig Signed-off-by: Carlos Maiolino --- diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 969bfc9d..2fce657a 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -2712,12 +2712,8 @@ xfs_dabuf_map( * larger one that needs to be free by the caller. */ if (nirecs > 1) { - map = kzalloc(nirecs * sizeof(struct xfs_buf_map), - GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL); - if (!map) { - error = -ENOMEM; - goto out_free_irecs; - } + map = kcalloc(nirecs, sizeof(struct xfs_buf_map), + GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL); *mapp = map; }