All of lore.kernel.org
 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
  0 siblings, 0 replies; 4+ 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] 4+ messages in thread

* [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree()
@ 2017-10-18  7:36 ` Dan Carpenter
  0 siblings, 0 replies; 4+ 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] 4+ messages in thread

* Re: [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
  -1 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-10-18 12:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Chris Mason, Josef Bacik, kernel-janitors, linux-btrfs

On Wed, Oct 18, 2017 at 10:36:35AM +0300, Dan Carpenter wrote:
> 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>

Thanks, I've folded the fix into the original commit and added credits.

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

* Re: [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree()
@ 2017-10-18 12:33   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2017-10-18 12:33 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Chris Mason, Josef Bacik, kernel-janitors, linux-btrfs

On Wed, Oct 18, 2017 at 10:36:35AM +0300, Dan Carpenter wrote:
> 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>

Thanks, I've folded the fix into the original commit and added credits.

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

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

Thread overview: 4+ 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  7:36 ` Dan Carpenter
2017-10-18 12:33 ` David Sterba
2017-10-18 12:33   ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.