From: Sinan Kaya <ok...@kernel.org>

In memzone_reserve_aligned_thread_unsafe result of call
to malloc_elem_from_data is dereferenced here and may be null.

Signed-off-by: Sinan Kaya <ok...@kernel.org>
---
 lib/eal/common/eal_common_memzone.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/eal/common/eal_common_memzone.c 
b/lib/eal/common/eal_common_memzone.c
index 8d472505eb..930fee5fdc 100644
--- a/lib/eal/common/eal_common_memzone.c
+++ b/lib/eal/common/eal_common_memzone.c
@@ -169,6 +169,10 @@ memzone_reserve_aligned_thread_unsafe(const char *name, 
size_t len,
        }
 
        struct malloc_elem *elem = malloc_elem_from_data(mz_addr);
+       if (elem == NULL) {
+               rte_errno = ENOSPC;
+               return NULL;
+       }
 
        /* fill the zone in config */
        mz_idx = rte_fbarray_find_next_free(arr, 0);
-- 
2.25.1

Reply via email to