From: Dan Carpenter <dan.carpenter@oracle.com> To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com> Cc: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree() Date: Wed, 18 Oct 2017 10:36:35 +0300 [thread overview] Message-ID: <20171018073635.cajusx7hzkg4ghgc@mwanda> (raw) 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; }
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com> Cc: David Sterba <dsterba@suse.com>, linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree() Date: Wed, 18 Oct 2017 07:36:35 +0000 [thread overview] Message-ID: <20171018073635.cajusx7hzkg4ghgc@mwanda> (raw) 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; }
next reply other threads:[~2017-10-18 7:37 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-10-18 7:36 Dan Carpenter [this message] 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 2017-10-18 12:33 ` David Sterba
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20171018073635.cajusx7hzkg4ghgc@mwanda \ --to=dan.carpenter@oracle.com \ --cc=clm@fb.com \ --cc=dsterba@suse.com \ --cc=josef@toxicpanda.com \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-btrfs@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.