public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dsterba@suse.com
Cc: linux-btrfs@vger.kernel.org
Subject: [bug report] btrfs: get fs_info from block group in write_pinned_extent_entries
Date: Wed, 24 Apr 2019 12:52:54 +0300	[thread overview]
Message-ID: <20190423141426.GA9375@mwanda> (raw)

Hello David Sterba,

This is a semi-automatic email about new static checker warnings.

The patch b4c7c5d50791: "btrfs: get fs_info from block group in
write_pinned_extent_entries" from Mar 20, 2019, leads to the
following Smatch complaint:

    fs/btrfs/free-space-cache.c:1052 write_pinned_extent_entries()
    warn: variable dereferenced before check 'block_group' (see line 1047)

fs/btrfs/free-space-cache.c
  1046	{
  1047		struct btrfs_fs_info *fs_info = block_group->fs_info;
                                                ^^^^^^^^^^^^^^^^^^^^
The patch adds a dereference

  1048		u64 start, extent_start, extent_end, len;
  1049		struct extent_io_tree *unpin = NULL;
  1050		int ret;
  1051	
  1052		if (!block_group)
                     ^^^^^^^^^^^
But the old code assumed it could be NULL.

  1053			return 0;
  1054	

See also:
fs/btrfs/free-space-cache.c:1319 __btrfs_write_out_cache() warn: variable dereferenced before check 'block_group' (see line 1295)
fs/btrfs/free-space-cache.c:1295 __btrfs_write_out_cache() error: we previously assumed 'block_group' could be null (see line 1253)

regards,
dan carpenter

             reply	other threads:[~2019-04-24  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24  9:52 Dan Carpenter [this message]
2019-04-24 13:41 ` [bug report] btrfs: get fs_info from block group in write_pinned_extent_entries David Sterba

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=20190423141426.GA9375@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dsterba@suse.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