Skip to content

Commit

Permalink
app/bbdev: check memory allocation
Browse files Browse the repository at this point in the history
[ upstream commit bc4c941 ]

Return value of a function 'rte_malloc' is dereferenced without
checking, and may result in segmentation fault.

This patch fixed it.

Fixes: 31a7853 ("baseband/turbo_sw: support large size code block")

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Nicolas Chautru <nicolas.chautru@intel.com>
  • Loading branch information
hushenggitcount authored and steevenlee committed Jun 8, 2021
1 parent 2194792 commit 90ca87d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/test-bbdev/test_bbdev_perf.c
Expand Up @@ -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);
Expand Down

0 comments on commit 90ca87d

Please sign in to comment.