lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220128123558.1223205-1-usama.anjum@collabora.com>
Date:   Fri, 28 Jan 2022 17:35:58 +0500
From:   Muhammad Usama Anjum <usama.anjum@...labora.com>
To:     Chris Mason <clm@...com>, Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>, Qu Wenruo <wqu@...e.com>
Cc:     Muhammad Usama Anjum <usama.anjum@...labora.com>,
        kernel@...labora.com, kernel-janitors@...r.kernel.org,
        linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] btrfs: initialize offset early

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@...labora.com>
---
 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);
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ