[v2,04/11] memzone: check result of malloc_elem_from_data
Checks
Commit Message
From: Sinan Kaya <okaya@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 <okaya@kernel.org>
---
lib/eal/common/eal_common_memzone.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
2022-11-21 17:32 (UTC-0500), okaya@kernel.org:
> From: Sinan Kaya <okaya@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 <okaya@kernel.org>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
@@ -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);