Commit 90e2c1c2 authored by Dave Chinner's avatar Dave Chinner Committed by Darrick J. Wong

xfs: perag may be null in xfs_imap()

Dan Carpenter's static checker reported:

The patch 7b13c515: "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: 7b13c515 ("xfs: use perag for ialloc btree cursors")
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarAllison Henderson <allison.henderson@oracle.com>
parent d1015e2e
......@@ -2398,6 +2398,7 @@ xfs_imap(
}
error = 0;
out_drop:
if (pag)
xfs_perag_put(pag);
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment