linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: josef@toxicpanda.com
Cc: linux-btrfs@vger.kernel.org
Subject: [bug report] Btrfs: replace tree->mapping with tree->private_data
Date: Wed, 28 Jun 2017 14:29:13 +0300	[thread overview]
Message-ID: <20170628112912.u3ivq4ge77u7pp7d@mwanda> (raw)

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

                 reply	other threads:[~2017-06-28 11:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170628112912.u3ivq4ge77u7pp7d@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=josef@toxicpanda.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;
as well as URLs for NNTP newsgroup(s).