* [PATCH] btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warning in extent_fiemap()
@ 2024-08-20 23:31 David Sterba
2024-08-21 17:29 ` Josef Bacik
0 siblings, 1 reply; 2+ messages in thread
From: David Sterba @ 2024-08-20 23:31 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba, Geert Uytterhoeven
There's a warning (probably on some older compiler version):
fs/btrfs/fiemap.c: warning: 'last_extent_end' may be used uninitialized in this function [-Wmaybe-uninitialized]: => 822:19
Initialize the variable to 0 although it's not necessary as it's either
properly set or not used after an error. The called function is in the
same file so this is a false alert but we want to fix all
-Wmaybe-uninitialized reports.
Link: https://lore.kernel.org/all/20240819070639.2558629-1-geert@linux-m68k.org/
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/fiemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/fiemap.c b/fs/btrfs/fiemap.c
index 8f95f3e44e99..df7f09f3b02e 100644
--- a/fs/btrfs/fiemap.c
+++ b/fs/btrfs/fiemap.c
@@ -637,7 +637,7 @@ static int extent_fiemap(struct btrfs_inode *inode,
struct btrfs_path *path;
struct fiemap_cache cache = { 0 };
struct btrfs_backref_share_check_ctx *backref_ctx;
- u64 last_extent_end;
+ u64 last_extent_end = 0;
u64 prev_extent_end;
u64 range_start;
u64 range_end;
--
2.45.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warning in extent_fiemap()
2024-08-20 23:31 [PATCH] btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warning in extent_fiemap() David Sterba
@ 2024-08-21 17:29 ` Josef Bacik
0 siblings, 0 replies; 2+ messages in thread
From: Josef Bacik @ 2024-08-21 17:29 UTC (permalink / raw)
To: David Sterba; +Cc: linux-btrfs, Geert Uytterhoeven
On Wed, Aug 21, 2024 at 01:31:32AM +0200, David Sterba wrote:
> There's a warning (probably on some older compiler version):
>
> fs/btrfs/fiemap.c: warning: 'last_extent_end' may be used uninitialized in this function [-Wmaybe-uninitialized]: => 822:19
>
> Initialize the variable to 0 although it's not necessary as it's either
> properly set or not used after an error. The called function is in the
> same file so this is a false alert but we want to fix all
> -Wmaybe-uninitialized reports.
>
> Link: https://lore.kernel.org/all/20240819070639.2558629-1-geert@linux-m68k.org/
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-21 17:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-20 23:31 [PATCH] btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warning in extent_fiemap() David Sterba
2024-08-21 17:29 ` Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).