From nobody Tue Jun 30 00:49:59 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED254C4332F for ; Fri, 28 Jan 2022 12:36:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348518AbiA1MgV (ORCPT ); Fri, 28 Jan 2022 07:36:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231153AbiA1MgU (ORCPT ); Fri, 28 Jan 2022 07:36:20 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D74C061714; Fri, 28 Jan 2022 04:36:19 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: usama.anjum) with ESMTPSA id 767F21F45EEA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643373377; bh=YtNcSY4XVYMhivO+4b/pttldYIe/hSGVUaO4aQU8K48=; h=From:To:Cc:Subject:Date:From; b=HafNsL5TwEyIN1EqH+qVuV9c/oRkylS8g8M/EPoCZ2watO47Hc9bRD2C6Zm1+WCnx aKptfjUesye4RIKjag/GHygSmsvAJQhUonu3z5j/alHkV98Lfq/vW7KOAF4Z2MaSIh UtAFXRiTi6daP8BlLqFua+Vuxj6IIRhlcns8gkYrK9EyiEL5ulfIDfQ9X3gbyyGBHw wlaSrfhYa07g4i+Elj/0dQnhvR4KtNAo8tEtZOU8YYhigGaQ3bfJNkxvcf2C7SUk5D xeCz5cRayjo+z2NfeOX7PpPnZ7+W1pLtnDoyfz1gQagn602hRDxdfz454GbGmFlQvQ F2xIkBmxVmMbA== From: Muhammad Usama Anjum To: Chris Mason , Josef Bacik , David Sterba , Qu Wenruo Cc: Muhammad Usama Anjum , kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] btrfs: initialize offset early Date: Fri, 28 Jan 2022 17:35:58 +0500 Message-Id: <20220128123558.1223205-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 dat= a stripe scrub") Signed-off-by: Muhammad Usama Anjum --- 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 scr= ub_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 =3D 0; /* Offset inside the chunk */ u64 stripe_logical; u64 stripe_end; =20 @@ -3602,7 +3602,6 @@ static noinline_for_stack int scrub_stripe(struct scr= ub_ctx *sctx, ASSERT(map->type & BTRFS_BLOCK_GROUP_RAID56_MASK); =20 physical =3D map->stripes[stripe_index].physical; - offset =3D 0; nstripes =3D div64_u64(dev_extent_len, map->stripe_len); get_raid56_logic_offset(physical, stripe_index, map, &offset, NULL); increment =3D map->stripe_len * nr_data_stripes(map); --=20 2.30.2