linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: Btrfs: get/set for struct header fields
@ 2016-03-18  5:37 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-03-18  5:37 UTC (permalink / raw)
  To: chris.mason; +Cc: linux-btrfs

Hello Chris Mason,

The patch 7518a238ea01: "Btrfs: get/set for struct header fields"
from Mar 12, 2007, leads to the following static checker warning:

	fs/btrfs/print-tree.c:359 btrfs_print_tree()
	error: 'next' dereferencing possible ERR_PTR()

fs/btrfs/print-tree.c
   355          for (i = 0; i < nr; i++) {
   356                  struct extent_buffer *next = read_tree_block(root,
                                                     ^^^^^^^^^^^^^^^
This function can fail.  The original code was buggy as well before
7518a238ea01.

   357                                          btrfs_node_blockptr(c, i),
   358                                          btrfs_node_ptr_generation(c, i));
   359                  if (btrfs_is_leaf(next) &&
   360                     level != 1)
   361                          BUG();
   362                  if (btrfs_header_level(next) !=
   363                         level - 1)
   364                          BUG();
   365                  btrfs_print_tree(root, next);
   366                  free_extent_buffer(next);
   367          }


regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-18  5:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-18  5:37 Btrfs: get/set for struct header fields Dan Carpenter

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