[PATCH 06/11] malloc: check result of rte_mem_virt2memseg_list
okaya at kernel.org
okaya at kernel.org
Mon Nov 21 21:40:12 CET 2022
From: Sinan Kaya <okaya at kernel.org>
In alloc_pages_on_heap result of call to rte_mem_virt2memseg_list
is dereferenced here and may be null.
Signed-off-by: Sinan Kaya <okaya at kernel.org>
---
lib/eal/common/malloc_heap.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/eal/common/malloc_heap.c b/lib/eal/common/malloc_heap.c
index d2ccc387bf..438c0856e2 100644
--- a/lib/eal/common/malloc_heap.c
+++ b/lib/eal/common/malloc_heap.c
@@ -324,6 +324,9 @@ alloc_pages_on_heap(struct malloc_heap *heap, uint64_t pg_sz, size_t elt_size,
map_addr = ms[0]->addr;
msl = rte_mem_virt2memseg_list(map_addr);
+ if (!msl) {
+ return NULL;
+ }
/* check if we wanted contiguous memory but didn't get it */
if (contig && !eal_memalloc_is_contig(msl, map_addr, alloc_sz)) {
--
2.25.1
More information about the dev
mailing list