Skip to content

Commit

Permalink
xfs: perag may be null in xfs_imap()
Browse files Browse the repository at this point in the history
Dan Carpenter's static checker reported:

The patch 7b13c51: "xfs: use perag for ialloc btree cursors"
from Jun 2, 2021, leads to the following Smatch complaint:

    fs/xfs/libxfs/xfs_ialloc.c:2403 xfs_imap()
    error: we previously assumed 'pag' could be null (see line 2294)

And it's right. Fix it.

Fixes: 7b13c51 ("xfs: use perag for ialloc btree cursors")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
  • Loading branch information
Dave Chinner authored and Darrick J. Wong committed Jun 18, 2021
1 parent d1015e2 commit 90e2c1c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/xfs/libxfs/xfs_ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2398,7 +2398,8 @@ xfs_imap(
}
error = 0;
out_drop:
xfs_perag_put(pag);
if (pag)
xfs_perag_put(pag);
return error;
}

Expand Down

0 comments on commit 90e2c1c

Please sign in to comment.