Message ID | tencent_B7D657EF5135C40D0303A1C3AC90CB0B9507@qq.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | lib/radix-tree: Fix uninitialized variable compilation warning | expand |
On Thu, Nov 10, 2022 at 01:00:42PM +0800, Rong Tao wrote: > radix_tree_load_root(root, &node, &maxindex); > - if (index > maxindex) > + if (index > maxindex || !node) > return NULL; No, stop it, you don't know what you're doing.
Thanks for your reply, actually, at first time, i just want to fix the compile warning, and i don't really know about the radix tree code, i'm sorry, i hope i can do it better next time. Rong Tao.
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 3c78e1e8b2ad..eee453b856b6 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c @@ -1029,10 +1029,10 @@ 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) + if (index > maxindex || !node) return NULL; parent = NULL;