diff mbox series

btrfs: fix an IS_ERR() vs NULL bug

Message ID 20220127084834.GB25644@kili (mailing list archive)
State New, archived
Headers show
Series btrfs: fix an IS_ERR() vs NULL bug | expand

Commit Message

Dan Carpenter Jan. 27, 2022, 8:48 a.m. UTC
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 <dan.carpenter@oracle.com>
---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

David Sterba Jan. 28, 2022, 3:34 p.m. UTC | #1
On Thu, Jan 27, 2022 at 11:48:34AM +0300, Dan Carpenter wrote:
> 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 <dan.carpenter@oracle.com>

Folded to the patch, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 98ad92041ae4..791dd31360f9 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -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);