From: Didier Pallard <didier.pall...@6wind.com>

initialised field must be checked against INITIALISED value before
allowing malloc to occur, else some core may pass the test and start
malloc while heap is in INITIALISING state and is not fully initialized.

Signed-off-by: Didier Pallard <didier.pallard at 6wind.com>
---
 lib/librte_malloc/malloc_heap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c
index 64668cb..eed8a63 100644
--- a/lib/librte_malloc/malloc_heap.c
+++ b/lib/librte_malloc/malloc_heap.c
@@ -197,7 +197,7 @@ void *
 malloc_heap_alloc(struct malloc_heap *heap,
                const char *type __attribute__((unused)), size_t size, unsigned 
align)
 {
-       if (!heap->initialised)
+       if (heap->initialised != INITIALISED)
                malloc_heap_init(heap);

        size = CACHE_LINE_ROUNDUP(size);
@@ -227,7 +227,7 @@ int
 malloc_heap_get_stats(const struct malloc_heap *heap,
                struct rte_malloc_socket_stats *socket_stats)
 {
-       if (!heap->initialised)
+       if (heap->initialised != INITIALISED)
                return -1;

        struct malloc_elem *elem = heap->free_head;
-- 
1.7.10.4

Reply via email to