linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree()
@ 2017-10-18  7:36 Dan Carpenter
  2017-10-18 12:33 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-10-18  7:36 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik; +Cc: David Sterba, linux-btrfs, kernel-janitors

read_tree_block() returns error pointers, and never NULL and so I have
updated the error handling.

Fixes: 74739121b4c7 ("Btrfs: add a extent ref verify tool")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c
index f65d78cf3c7e..34878699d363 100644
--- a/fs/btrfs/ref-verify.c
+++ b/fs/btrfs/ref-verify.c
@@ -584,7 +584,9 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			gen = btrfs_node_ptr_generation(path->nodes[level],
 							path->slots[level]);
 			eb = read_tree_block(fs_info, block_bytenr, gen);
-			if (!eb || !extent_buffer_uptodate(eb)) {
+			if (IS_ERR(eb))
+				return PTR_ERR(eb);
+			if (!extent_buffer_uptodate(eb)) {
 				free_extent_buffer(eb);
 				return -EIO;
 			}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-18 12:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-18  7:36 [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree() Dan Carpenter
2017-10-18 12:33 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).