Commit a593c89a authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Carlos Maiolino
Browse files

xfs: remove NULL pointer checks in xfs_mru_cache_insert



Remove the check for a NULL mru or mru->list in xfs_mru_cache_insert
as this API misused lead to a direct NULL pointer dereference on first
use and is not user triggerable.  As a smatch run by Dan points out
with the recent cleanup it would otherwise try to free the object we
just determined to be NULL for this impossible to reach case.

Fixes: 70b95cb8 ("xfs: free the item in xfs_mru_cache_insert on failure")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent b0f77d30
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -425,10 +425,6 @@ xfs_mru_cache_insert(
{
	int			error = -EINVAL;

	ASSERT(mru && mru->lists);
	if (!mru || !mru->lists)
		goto out_free;

	error = -ENOMEM;
	if (radix_tree_preload(GFP_KERNEL))
		goto out_free;