From bc4c9418ee0fc22c480c236846af7fbad923ba89 Mon Sep 17 00:00:00 2001 From: "Min Hu (Connor)" Date: Thu, 22 Apr 2021 17:25:05 +0800 Subject: [PATCH] app/bbdev: check memory allocation Return value of a function 'rte_malloc' is dereferenced without checking, and may result in segmentation fault. This patch fixed it. Fixes: 31a7853d1ed9 ("baseband/turbo_sw: support large size code block") Cc: stable@dpdk.org Signed-off-by: Min Hu (Connor) Acked-by: Nicolas Chautru --- app/test-bbdev/test_bbdev_perf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c index 45b85b984c..f94e2a94d0 100644 --- a/app/test-bbdev/test_bbdev_perf.c +++ b/app/test-bbdev/test_bbdev_perf.c @@ -957,6 +957,9 @@ init_op_data_objs(struct rte_bbdev_op_data *bufs, if ((op_type == DATA_INPUT) && large_input) { /* Allocate a fake overused mbuf */ data = rte_malloc(NULL, seg->length, 0); + TEST_ASSERT_NOT_NULL(data, + "rte malloc failed with %u bytes", + seg->length); memcpy(data, seg->addr, seg->length); m_head->buf_addr = data; m_head->buf_iova = rte_malloc_virt2iova(data); -- 2.20.1