Skip to contentSkip to conversation

baseband/turbo_sw: fix dereference of null

PATCH Applied Min Hu (Connor) 3 participants 3 messages Apr 22, 2021 – May 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 baseband/turbo_sw: fix dereference of null

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

This patch fixed it.

Fixes 31a7853d1ed9 ("baseband/turbo_sw: support large size code block")
---
 app/test-bbdev/test_bbdev_perf.c | 3 +++
 1 file changed, 3 insertions(+)
app/test-bbdev/test_bbdev_perf.c +3 -0
index 45b85b9..f94e2a9 100644
@@ -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);
Signature · 1 line
2.7.4
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 22, 2021 2:25 AM

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

Quoted 6 lines

This patch fixed it.

Fixes 31a7853d1ed9 ("baseband/turbo_sw: support large size code block")
Quoted 22 lines
---
 app/test-bbdev/test_bbdev_perf.c | 3 +++
 1 file changed, 3 insertions(+)
app/test- renamed from app/test-bbdev/test_bbdev_perf.c +0 -0

bbdev/test_bbdev_perf.c
index 45b85b9..f94e2a9 100644

app/test-bbdev/test_bbdev_perf.c +3 -0
@@ -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.7.4

Applied
#2 lore raw
Quoted 9 lines
Quoted 9 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Thursday, April 22, 2021 2:25 AM

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

Quoted 9 lines
Quoted 6 lines

This patch fixed it.

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

Applied to dpdk-next-crypto

Thanks.