* [PATCH] btrfs: fix an IS_ERR() vs NULL bug
@ 2022-01-27 8:48 Dan Carpenter
2022-01-28 15:34 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-01-27 8:48 UTC (permalink / raw)
To: Chris Mason, Qu Wenruo
Cc: Josef Bacik, David Sterba, linux-btrfs, kernel-janitors
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(-)
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);
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] btrfs: fix an IS_ERR() vs NULL bug
2022-01-27 8:48 [PATCH] btrfs: fix an IS_ERR() vs NULL bug Dan Carpenter
@ 2022-01-28 15:34 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-01-28 15:34 UTC (permalink / raw)
To: Dan Carpenter
Cc: Chris Mason, Qu Wenruo, Josef Bacik, David Sterba, linux-btrfs,
kernel-janitors
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-28 15:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-27 8:48 [PATCH] btrfs: fix an IS_ERR() vs NULL bug Dan Carpenter
2022-01-28 15:34 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox