Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Liu Bo <bo.li.liu@oracle.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Btrfs: fix up read_tree_block to return proper error
Date: Mon, 21 Mar 2016 12:16:28 -0700	[thread overview]
Message-ID: <20160321191628.GB1111@localhost.localdomain> (raw)
In-Reply-To: <20160318053713.GA2111@mwanda>

Hi Dan,

On Fri, Mar 18, 2016 at 08:37:13AM +0300, Dan Carpenter wrote:
> Hello Liu Bo,
> 
> The patch 64c043de466d: "Btrfs: fix up read_tree_block to return
> proper error" from May 25, 2015, leads to the following static
> checker warning:
> 
> 	fs/btrfs/relocation.c:1858 replace_path()
> 	error: 'eb' dereferencing possible ERR_PTR()
> 
> fs/btrfs/relocation.c
>   1850                          eb = read_tree_block(dest, old_bytenr, old_ptr_gen);
>   1851                          if (IS_ERR(eb)) {
>                                     ^^^^^^^^^^
> 
>   1852                                  ret = PTR_ERR(eb);
> 
> Missing break or continue?
> 
>   1853                          } else if (!extent_buffer_uptodate(eb)) {
>   1854                                  ret = -EIO;
>   1855                                  free_extent_buffer(eb);
>   1856                                  break;
>   1857                          }
>   1858                          btrfs_tree_lock(eb);
>                                                 ^^
> Dereference.
> 
>   1859                          if (cow) {
>   1860                                  ret = btrfs_cow_block(trans, dest, eb, parent,
>   1861                                                        slot, &eb);

Ah, thanks a lot for reporting this!

I've double checked other places in that patch, the above one is the only place
we have such a problem.

I'll cook a patch to fix it.

Thanks,

-liubo

      reply	other threads:[~2016-03-21 23:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  5:37 Btrfs: fix up read_tree_block to return proper error Dan Carpenter
2016-03-21 19:16 ` Liu Bo [this message]

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=20160321191628.GB1111@localhost.localdomain \
    --to=bo.li.liu@oracle.com \
    --cc=dan.carpenter@oracle.com \
    --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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox