btrfs: fix an IS_ERR() vs NULL bug
Subsystems (2)
PATCH 1/1 btrfs: fix an IS_ERR() vs NULL bug
The alloc_dummy_extent_buffer() function does not return error pointers, it returns NULL on failure.
Fixes 5068210cf625 ("btrfs: use dummy extent buffer for super block sys chunk array read")
Signed-off-by Dan Carpenter <[email protected]>
--- fs/btrfs/volumes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/volumes.c +2 -2
@@ -7389,8 +7389,8 @@ int btrfs_read_sys_array(struct btrfs_fs_info *fs_info)* that's fine, we will not go beyond system chunk array anyway. */ sb =alloc_dummy_extent_buffer (fs_info,BTRFS_SUPER_INFO_OFFSET ); -if (IS_ERR (sb)) -return PTR_ERR (sb); +if (!sb) +return -ENOMEM ;set_extent_buffer_uptodate (sb);write_extent_buffer (sb, super_copy,0 ,BTRFS_SUPER_INFO_SIZE );
Signature · 1 line
2.20.1
Quoted 5 lines · Dan Carpenter
The
alloc_dummy_extent_buffer()function does not return error pointers, it returns NULL on failure.Fixes 5068210cf625 ("btrfs: use dummy extent buffer for super block sys chunk array read")Signed-off-by Dan Carpenter <[email protected]>
Folded to the patch, thanks.