From 93e8b661f6ff3ab6f355a5a6e3fe8814e7002d5e Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Thu, 28 Sep 2023 13:36:34 +0930 Subject: [PATCH] btrfs-progs: fix a variable shadowing when enabling experimental features There is another variable shadowing problem which can only be exposed if experimental features are enabled. Inside the branch of BTRFS_PRINT_TREE_CSUM_HEADERS, we declare another local variable @csum, shadowing the @csum of print_header_info(), which is only declared when experimental features are enabled. Just rename the @csum to @tree_csum to avoid the problem. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- kernel-shared/print-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c index b895ced2..eb21d9e2 100644 --- a/kernel-shared/print-tree.c +++ b/kernel-shared/print-tree.c @@ -1311,12 +1311,12 @@ static void print_header_info(struct extent_buffer *eb, unsigned int mode) printf("\n"); if (fs_info && (mode & BTRFS_PRINT_TREE_CSUM_HEADERS)) { char *tmp = csum_str; - u8 *csum = (u8 *)(eb->data + offsetof(struct btrfs_header, csum)); + u8 *tree_csum = (u8 *)(eb->data + offsetof(struct btrfs_header, csum)); strcpy(csum_str, " csum 0x"); tmp = csum_str + strlen(csum_str); for (i = 0; i < csum_size; i++) { - sprintf(tmp, "%02x", csum[i]); + sprintf(tmp, "%02x", tree_csum[i]); tmp++; tmp++; }