public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: avoid spurious -Wmaybe-uninitialized warnings in do_remap_reloc_trans()
@ 2026-01-20 12:49 Mark Harmstone
  2026-01-20 16:31 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Harmstone @ 2026-01-20 12:49 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Mark Harmstone

find_next_identity_remap() sets the values of the start and length
pointers if it returns 0. Some versions of GCC are unable to analyse
this properly and give spurious -Wmaybe-uninitialized warnings, so
initialize the values in do_remap_reloc_trans() to avoid this.

Signed-off-by: Mark Harmstone <mark@harmstone.com>
---
 fs/btrfs/relocation.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 065db3f7840e..da4749d6bfa0 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4940,7 +4940,8 @@ static int do_remap_reloc_trans(struct btrfs_fs_info *fs_info,
 	struct btrfs_root *extent_root;
 	struct btrfs_key ins;
 	struct btrfs_block_group *dest_bg = NULL;
-	u64 start, remap_length, length, new_addr, min_size;
+	u64 start = 0, remap_length = 0;
+	u64 length, new_addr, min_size;
 	int ret;
 	bool no_more = false;
 	bool is_data = (src_bg->flags & BTRFS_BLOCK_GROUP_DATA);
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-20 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 12:49 [PATCH] btrfs: avoid spurious -Wmaybe-uninitialized warnings in do_remap_reloc_trans() Mark Harmstone
2026-01-20 16:31 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox