btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warning in extent_fiemap()
David Sterba
maintainerPATCH 1/1 btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warning in extent_fiemap()
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.
--- fs/btrfs/fiemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/fiemap.c +1 -1
@@ -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;
Signature · 1 line
2.45.0
Quoted 4 lines · David Sterba
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
Quoted 8 lines
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.
Reported-by Geert Uytterhoeven <[email protected]>Signed-off-by David Sterba <[email protected]>
Thanks,
Josef