* [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
* Re: [PATCH] btrfs: avoid spurious -Wmaybe-uninitialized warnings in do_remap_reloc_trans()
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
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2026-01-20 16:31 UTC (permalink / raw)
To: Mark Harmstone; +Cc: linux-btrfs
On Tue, Jan 20, 2026 at 12:49:58PM +0000, Mark Harmstone wrote:
> 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>
Folded to for-next patch, please also mention to which patch it's
supposed to go to so I don't have to guess.
^ permalink raw reply [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