public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Harmstone <mark@harmstone.com>
To: linux-btrfs@vger.kernel.org
Cc: Mark Harmstone <mark@harmstone.com>
Subject: [PATCH] btrfs: avoid spurious -Wmaybe-uninitialized warnings in do_remap_reloc_trans()
Date: Tue, 20 Jan 2026 12:49:58 +0000	[thread overview]
Message-ID: <20260120125000.26588-1-mark@harmstone.com> (raw)

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


             reply	other threads:[~2026-01-20 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 12:49 Mark Harmstone [this message]
2026-01-20 16:31 ` [PATCH] btrfs: avoid spurious -Wmaybe-uninitialized warnings in do_remap_reloc_trans() David Sterba

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=20260120125000.26588-1-mark@harmstone.com \
    --to=mark@harmstone.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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