Skip to content

Commit 431d398

Browse files
austindhkimkdave
authored andcommitted
btrfs: silence maybe-uninitialized warning in clone_range
GCC throws warning message as below: ‘clone_src_i_size’ may be used uninitialized in this function [-Wmaybe-uninitialized] #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) ^ fs/btrfs/send.c:5088:6: note: ‘clone_src_i_size’ was declared here u64 clone_src_i_size; ^ The clone_src_i_size is only used as call-by-reference in a call to get_inode_info(). Silence the warning by initializing clone_src_i_size to 0. Note that the warning is a false positive and reported by older versions of GCC (eg. 7.x) but not eg 9.x. As there have been numerous people, the patch is applied. Setting clone_src_i_size to 0 does not otherwise make sense and would not do any action in case the code changes in the future. Signed-off-by: Austin Kim <[email protected]> Reviewed-by: David Sterba <[email protected]> [ add note ] Signed-off-by: David Sterba <[email protected]>
1 parent c5f4987 commit 431d398

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5085,7 +5085,7 @@ static int clone_range(struct send_ctx *sctx,
50855085
struct btrfs_path *path;
50865086
struct btrfs_key key;
50875087
int ret;
5088-
u64 clone_src_i_size;
5088+
u64 clone_src_i_size = 0;
50895089

50905090
/*
50915091
* Prevent cloning from a zero offset with a length matching the sector

0 commit comments

Comments
 (0)