linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [bug report] btrfs: scan but don't register device on single device filesystem
Date: Fri, 15 Sep 2023 16:22:19 +0800	[thread overview]
Message-ID: <89644c59-181b-a9d3-1140-8e74328b36bc@oracle.com> (raw)
In-Reply-To: <32e15558-0a3f-418a-b3ae-8cfbddbff7af@moroto.mountain>


Thanks for the report.

> 
> fs/btrfs/volumes.c
>      1411         if (!mount_arg_dev && btrfs_super_num_devices(disk_super) == 1 &&
>      1412             !(btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_SEEDING)) {
>      1413                 dev_t        devt;
>      1414
>      1415                 ret = lookup_bdev(path, &devt);
>      1416                 if (ret) {
>      1417                         btrfs_warn(NULL, "lookup bdev failed for path %s: %d",
>      1418                         path, ret);
> 
> Should this goto?
> 
>      1419                 }
> --> 1420                 btrfs_free_stale_devices(devt, NULL);
>                                                    ^^^^
> Uninitialized if lookup_bdev() fails.

  We have to call btrfs_free_stale_devices() under the 'else' part;
  its the only one using devt.

  I have sent out the fix.

[PATCH] btrfs: fix smatch static checker warning in btrfs_scan_one_device


-Anand

      reply	other threads:[~2023-09-15  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15  7:05 [bug report] btrfs: scan but don't register device on single device filesystem Dan Carpenter
2023-09-15  8:22 ` Anand Jain [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=89644c59-181b-a9d3-1140-8e74328b36bc@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dan.carpenter@linaro.org \
    --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).