Re: [PATCH] xfs: xfs_rmap_item: Add ASSERT after calling kmem_zalloc

From: Dave Chinner
Date: Thu Mar 10 2022 - 16:20:58 EST


On Thu, Mar 10, 2022 at 05:43:03PM +0800, Jiasheng Jiang wrote:
> As the potential failure of the kmem_zalloc() without __GFP_NOFAIL,
> it should be better to check it in order to avoid the dereference
> of NULL pointer.

kmem_zalloc() won't ever fail unless it is passed KM_MAYFAIL. i.e.
it has __GFP_NOFAIL behaviour when no flags are passed to it, as the
code in xfs_rui_init() does.

Cheers,

Dave.
--
Dave Chinner
david@xxxxxxxxxxxxx