From caecf3b72f8babe1e197f235b16ced1d7090eda2 Mon Sep 17 00:00:00 2001 From: John Sanpe Date: Tue, 12 Aug 2025 09:34:31 +0800 Subject: [PATCH] fixup heap: fixed the bug of uninitialized variables Signed-off-by: John Sanpe --- src/heap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/heap.c b/src/heap.c index 3f375632..dc604278 100644 --- a/src/heap.c +++ b/src/heap.c @@ -6,6 +6,7 @@ #include #include #include +#include #include static __bfdev_always_inline void @@ -179,12 +180,14 @@ bfdev_heap_parent(bfdev_heap_root_t *root, bfdev_heap_node_t **parentp, unsigned int depth; link = &root->node; - if (bfdev_unlikely(!*link)) { - *parentp = BFDEV_NULL; + *parentp = BFDEV_NULL; + + if (bfdev_unlikely(!*link)) return link; - } depth = bfdev_flsuf(root->count + 1); + BFDEV_BUG_ON(!depth); + while (depth--) { *parentp = *link; if ((root->count + 1) & BFDEV_BIT(depth))