Skip to contentSkip to conversation

btrfs: fix an IS_ERR() vs NULL bug

PATCH In review Dan Carpenter 2 participants 2 messages Jan 27, 2022 – Jan 28, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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")
---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/volumes.c +2 -2
index 98ad92041ae4..791dd31360f9 100644
@@ -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
#1 lore raw
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")

Folded to the patch, thanks.