Skip to content

Commit

Permalink
btrfs: initialize last_extent_end to fix -Wmaybe-uninitialized warnin…
Browse files Browse the repository at this point in the history
…g 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.

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>
  • Loading branch information
David Sterba committed Aug 26, 2024
1 parent 2d34472 commit 33f58a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/fiemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 33f58a0

Please sign in to comment.