public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Qu Wenruo <wqu@suse.com>
Cc: kernel@collabora.com, kernel-janitors@vger.kernel.org,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: initialize offset early
Date: Fri, 28 Jan 2022 20:39:38 +0800	[thread overview]
Message-ID: <cef3023e-121d-ad30-8b30-cf71c2da8d4e@gmx.com> (raw)
In-Reply-To: <20220128123558.1223205-1-usama.anjum@collabora.com>



On 2022/1/28 20:35, Muhammad Usama Anjum wrote:
> Jump to out label can happen before offset is initialized. offset is
> being used in code after out label. initialize offset early to cater
> this case.
>
> Fixes: 585f784357d8 ("btrfs: use scrub_simple_mirror() to handle RAID56 data stripe scrub")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Thanks for the fix.

Although the patch is only in misc-next, and due to another triggered
ASSERT(), the series will be reworked soon.

Thanks,
Qu

> ---
>   fs/btrfs/scrub.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 26bbe93c3aa3c..3ace9766527ba 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -3530,7 +3530,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
>   	u64 logic_end;
>   	u64 physical_end;
>   	u64 increment;	/* The logical increment after finishing one stripe */
> -	u64 offset;	/* Offset inside the chunk */
> +	u64 offset = 0;	/* Offset inside the chunk */
>   	u64 stripe_logical;
>   	u64 stripe_end;
>
> @@ -3602,7 +3602,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
>   	ASSERT(map->type & BTRFS_BLOCK_GROUP_RAID56_MASK);
>
>   	physical = map->stripes[stripe_index].physical;
> -	offset = 0;
>   	nstripes = div64_u64(dev_extent_len, map->stripe_len);
>   	get_raid56_logic_offset(physical, stripe_index, map, &offset, NULL);
>   	increment = map->stripe_len * nr_data_stripes(map);

  reply	other threads:[~2022-01-28 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 12:35 [PATCH] btrfs: initialize offset early Muhammad Usama Anjum
2022-01-28 12:39 ` Qu Wenruo [this message]
2022-01-31 12:39 ` Dan Carpenter

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=cef3023e-121d-ad30-8b30-cf71c2da8d4e@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=usama.anjum@collabora.com \
    --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