All of lore.kernel.org
 help / color / mirror / Atom feed
* re: Btrfs: fix up read_tree_block to return proper error
@ 2016-03-18  5:37 Dan Carpenter
  2016-03-21 19:16 ` Liu Bo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-03-18  5:37 UTC (permalink / raw)
  To: bo.li.liu; +Cc: linux-btrfs

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);

regards,
dan carpenter

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

* Re: Btrfs: fix up read_tree_block to return proper error
  2016-03-18  5:37 Btrfs: fix up read_tree_block to return proper error Dan Carpenter
@ 2016-03-21 19:16 ` Liu Bo
  0 siblings, 0 replies; 2+ messages in thread
From: Liu Bo @ 2016-03-21 19:16 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-btrfs

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

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

end of thread, other threads:[~2016-03-21 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.