[PATCH] examples/eventdev: Check for the NULL pointer after calling rte_zmalloc
835703180 at qq.com
835703180 at qq.com
Wed Jul 6 09:23:15 CEST 2022
From: Shiqi Liu <835703180 at qq.com>
As the possible failure of the rte_zmalloc(), the not_checked and
checked could be NULL pointer.
Therefore, it should be better to check it in order to avoid
the dereference of the NULL pointer.
Fixes: fa8054c8c88 ("examples/eventdev: add thread safe Tx worker pipeline")
Signed-off-by: Shiqi Liu <835703180 at qq.com>
---
examples/eventdev_pipeline/pipeline_worker_tx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/examples/eventdev_pipeline/pipeline_worker_tx.c b/examples/eventdev_pipeline/pipeline_worker_tx.c
index a82e064c1c..6ea676c516 100644
--- a/examples/eventdev_pipeline/pipeline_worker_tx.c
+++ b/examples/eventdev_pipeline/pipeline_worker_tx.c
@@ -764,7 +764,9 @@ init_adapters(uint16_t nb_ports)
ret = rte_event_dev_info_get(evdev_id, &dev_info);
adptr_services = rte_zmalloc(NULL, sizeof(struct rx_adptr_services), 0);
-
+ if (adptr_services == NULL) {
+ return -ENOMEM;
+ }
struct rte_event_port_conf adptr_p_conf = {
.dequeue_depth = cdata.worker_cq_depth,
.enqueue_depth = 64,
--
2.35.1.windows.2
More information about the dev
mailing list