public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: dsterba@suse.com, linux-btrfs@vger.kernel.org
Subject: Re: [bug report] btrfs: get fs_info from block group in write_pinned_extent_entries
Date: Wed, 24 Apr 2019 15:41:53 +0200	[thread overview]
Message-ID: <20190424134153.GW20156@twin.jikos.cz> (raw)
In-Reply-To: <20190423141426.GA9375@mwanda>

On Wed, Apr 24, 2019 at 12:52:54PM +0300, Dan Carpenter wrote:
> 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.

Thanks for the report. The pointer will never be null as the caller will
pass a valid pointer, so the dereference is ok. This extra check is
redundant so I'll remove it.

      reply	other threads:[~2019-04-24 13:40 UTC|newest]

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

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=20190424134153.GW20156@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=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