mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] radix tree test suite: Fix uninitialized variable compilation warning
@ 2022-11-09 14:34 Rong Tao
  2022-11-10  0:23 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Rong Tao @ 2022-11-09 14:34 UTC (permalink / raw)
  To: akpm; +Cc: Rong Tao, wuchi, open list

From: Rong Tao <rongtao@cestc.cn>

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);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
 lib/radix-tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
-- 
2.31.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-11-11  2:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-09 14:34 [PATCH] radix tree test suite: Fix uninitialized variable compilation warning Rong Tao
2022-11-10  0:23 ` Andrew Morton
2022-11-10  5:00   ` [PATCH] lib/radix-tree: " Rong Tao
2022-11-10 16:06     ` Matthew Wilcox
2022-11-11  2:11       ` Rong Tao
2022-11-10 16:06   ` [PATCH] radix tree test suite: " Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®