From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs: Fix uninitialized ret in btrfsic_process_superblock_dev_mirror
Date: Mon, 24 Feb 2020 21:00:38 +0800 [thread overview]
Message-ID: <1bbdca2e-b92f-b9dc-dc32-de4de377a7e7@gmx.com> (raw)
In-Reply-To: <20200224125628.27121-1-nborisov@suse.com>
On 2020/2/24 下午8:56, Nikolay Borisov wrote:
> We could return ret uninitlaized in case of success. Before the code was
> returning 0 explicitly in case of success but now it will be a random value from
> the stack. That's due to ret being set only in error conditions.
>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/check-integrity.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index 23dd65e1c5e3..85b27e9742c8 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -766,7 +766,7 @@ static int btrfsic_process_superblock_dev_mirror(
> struct block_device *const superblock_bdev = device->bdev;
> struct page *page;
> struct address_space *mapping = superblock_bdev->bd_inode->i_mapping;
> - int ret;
> + int ret = 0;
>
> /* super block bytenr is always the unmapped device bytenr */
> dev_bytenr = btrfs_sb_offset(superblock_mirror_num);
> --
> 2.17.1
>
prev parent reply other threads:[~2020-02-24 13:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-24 12:56 [PATCH] btrfs: Fix uninitialized ret in btrfsic_process_superblock_dev_mirror Nikolay Borisov
2020-02-24 12:57 ` Nikolay Borisov
2020-02-24 15:16 ` David Sterba
2020-02-24 13:00 ` Qu Wenruo [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=1bbdca2e-b92f-b9dc-dc32-de4de377a7e7@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@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