linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] Btrfs: replace tree->mapping with tree->private_data
@ 2017-06-28 11:29 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-06-28 11:29 UTC (permalink / raw)
  To: josef; +Cc: linux-btrfs

Hello Josef Bacik,

The patch c6100a4b4e3d: "Btrfs: replace tree->mapping with
tree->private_data" from May 5, 2017, leads to the following static
checker warning:

	fs/btrfs/extent_io.c:3424 __extent_writepage_io()
	error: we previously assumed 'tree->ops' could be null (see line 3334)

fs/btrfs/extent_io.c
  3404                           * compressed extents
  3405                           */
  3406                          if (!compressed && tree->ops &&
                                                   ^^^^^^^^^
This function consistently check tree->ops before dereferencing it.

  3407                              tree->ops->writepage_end_io_hook)
  3408                                  tree->ops->writepage_end_io_hook(page, cur,
  3409                                                           cur + iosize - 1,
  3410                                                           NULL, 1);
  3411                          else if (compressed) {
  3412                                  /* we don't want to end_page_writeback on
  3413                                   * a compressed extent.  this happens
  3414                                   * elsewhere
  3415                                   */
  3416                                  nr++;
  3417                          }
  3418  
  3419                          cur += iosize;
  3420                          pg_offset += iosize;
  3421                          continue;
  3422                  }
  3423  
  3424                  set_range_writeback(tree, cur, cur + iosize - 1);
                                            ^^^^
The patch adds a new unchecked dereference.

regards,
dan carpenter

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

only message in thread, other threads:[~2017-06-28 11:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-28 11:29 [bug report] Btrfs: replace tree->mapping with tree->private_data 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).