Skip to content

Commit a593c89

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
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: 70b95cb ("xfs: free the item in xfs_mru_cache_insert on failure") Reported-by: Dan Carpenter <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Hans Holmberg <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent b0f77d3 commit a593c89

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

fs/xfs/xfs_mru_cache.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,10 +425,6 @@ xfs_mru_cache_insert(
425425
{
426426
int error = -EINVAL;
427427

428-
ASSERT(mru && mru->lists);
429-
if (!mru || !mru->lists)
430-
goto out_free;
431-
432428
error = -ENOMEM;
433429
if (radix_tree_preload(GFP_KERNEL))
434430
goto out_free;

0 commit comments

Comments
 (0)