Skip to content

Commit 9c7e71c

Browse files
JohnsPonykdave
authored andcommitted
btrfs: fix Wmaybe-uninitialized warning in replay_one_buffer()
Warning was found when compiling using loongarch64-gcc 12.3.1: $ make CFLAGS_tree-log.o=-Wmaybe-uninitialized In file included from fs/btrfs/ctree.h:21, from fs/btrfs/tree-log.c:12: fs/btrfs/accessors.h: In function 'replay_one_buffer': fs/btrfs/accessors.h:66:16: warning: 'inode_item' may be used uninitialized [-Wmaybe-uninitialized] 66 | return btrfs_get_##bits(eb, s, offsetof(type, member)); \ | ^~~~~~~~~~ fs/btrfs/tree-log.c:2803:42: note: 'inode_item' declared here 2803 | struct btrfs_inode_item *inode_item; | ^~~~~~~~~~ Initialize the inode_item to NULL, the compiler does not seem to see the relation between the first 'wc->log_key.type == BTRFS_INODE_ITEM_KEY' check and the other one that also checks the replay phase. Signed-off-by: Qiang Ma <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 437cc60 commit 9c7e71c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/btrfs/tree-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2798,7 +2798,7 @@ static int replay_one_buffer(struct extent_buffer *eb,
27982798

27992799
nritems = btrfs_header_nritems(eb);
28002800
for (wc->log_slot = 0; wc->log_slot < nritems; wc->log_slot++) {
2801-
struct btrfs_inode_item *inode_item;
2801+
struct btrfs_inode_item *inode_item = NULL;
28022802

28032803
btrfs_item_key_to_cpu(eb, &wc->log_key, wc->log_slot);
28042804

0 commit comments

Comments
 (0)