Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: wqu@suse.com, linux-btrfs@vger.kernel.org
Subject: Re: [bug report] btrfs: extent_io: do extra check for extent buffer read write functions
Date: Fri, 15 Sep 2023 21:00:47 +0200	[thread overview]
Message-ID: <20230915190047.GH2747@twin.jikos.cz> (raw)
In-Reply-To: <b07914e7-137c-4549-97cb-2a0c3e757a04@moroto.mountain>

On Fri, Sep 15, 2023 at 10:10:13AM +0300, Dan Carpenter wrote:
> Hello Qu Wenruo,
> 
> The patch f98b6215d7d1: "btrfs: extent_io: do extra check for extent
> buffer read write functions" from Aug 19, 2020 (linux-next), leads to
> the following Smatch static checker warning:
> 
> fs/btrfs/print-tree.c:186 print_uuid_item() error: uninitialized symbol 'subvol_id'.
> fs/btrfs/tests/extent-io-tests.c:338 check_eb_bitmap() error: uninitialized symbol 'has'.
> fs/btrfs/tests/extent-io-tests.c:353 check_eb_bitmap() error: uninitialized symbol 'has'.
> fs/btrfs/uuid-tree.c:203 btrfs_uuid_tree_remove() error: uninitialized symbol 'read_subid'.
> fs/btrfs/uuid-tree.c:353 btrfs_uuid_tree_iterate() error: uninitialized symbol 'subid_le'.
> fs/btrfs/uuid-tree.c:72 btrfs_uuid_tree_lookup() error: uninitialized symbol 'data'.
> fs/btrfs/volumes.c:7415 btrfs_dev_stats_value() error: uninitialized symbol 'val'.
> 
> fs/btrfs/extent_io.c
>   4096  void read_extent_buffer(const struct extent_buffer *eb, void *dstv,
>   4097                          unsigned long start, unsigned long len)
>   4098  {
>   4099          void *eb_addr = btrfs_get_eb_addr(eb);
>   4100  
>   4101          if (check_eb_range(eb, start, len))
>   4102                  return;
>                         ^^^^^^^
> 
> Originally this used to memset dstv to zero but now it just returns.
> I can easily just mark that error path as impossible.  These days
> everyone with a brain zeros their stack variables anyway so it shouldn't
> affect anyone who doesn't deserve it.

Thanks, this explains the other errors reported on linux-next with
possibly uninitialized variables.

  reply	other threads:[~2023-09-15 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15  7:10 [bug report] btrfs: extent_io: do extra check for extent buffer read write functions Dan Carpenter
2023-09-15 19:00 ` David Sterba [this message]
2023-09-15 21:11   ` Qu Wenruo
2023-09-18 16:57     ` David Sterba
2023-09-19  2:07       ` Qu Wenruo
2023-09-19 16:26         ` 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=20230915190047.GH2747@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.com \
    /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