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
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to