From: Rong Tao Date: Wed, 9 Nov 2022 14:34:25 +0000 (+0800) Subject: lib/radix-tree.c: fix uninitialized variable compilation warning X-Git-Tag: configfs-6.13-2024-11-19~5246^2~22 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fc0e7387926d7704ba54ff0d20db80051392583d;p=users%2Fhch%2Fconfigfs.git lib/radix-tree.c: fix uninitialized variable compilation warning We need to set an initial value for offset to eliminate compilation warning. How to reproduce warning: $ make -C tools/testing/radix-tree radix-tree.c: In function `radix_tree_tag_clear': radix-tree.c:1046:17: warning: `offset' may be used uninitialized in this function [-Wmaybe-uninitialized] 1046 | node_tag_clear(root, parent, tag, offset); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Link: https://lkml.kernel.org/r/tencent_DF74099967595DCEA93CBDC28D062026180A@qq.com Signed-off-by: Rong Tao Cc: Matthew Wilcox Signed-off-by: Andrew Morton --- diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 3c78e1e8b2ad..049ba132f7ef 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -1029,7 +1029,7 @@ void *radix_tree_tag_clear(struct radix_tree_root *root, { struct radix_tree_node *node, *parent; unsigned long maxindex; - int offset; + int offset = 0; radix_tree_load_root(root, &node, &maxindex); if (index > maxindex)