One issue caught by Coverity 340075
*deref_ptr: Directly dereferencing pointer qp_info.

In eca_enq_to_cryptodev() qp_info dereferenced without
null check in both session and sessionless crypto ops.

The fix is to access qp_info after null check.

Coverity issue: 340075
Fixes: 7901eac340 ("eventdev: add crypto adapter implementation")
Cc: sta...@dpdk.org

Signed-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.b...@intel.com>
---
 lib/librte_eventdev/rte_event_crypto_adapter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eventdev/rte_event_crypto_adapter.c 
b/lib/librte_eventdev/rte_event_crypto_adapter.c
index 22d910816..4f3f57348 100644
--- a/lib/librte_eventdev/rte_event_crypto_adapter.c
+++ b/lib/librte_eventdev/rte_event_crypto_adapter.c
@@ -356,7 +356,7 @@ eca_enq_to_cryptodev(struct rte_event_crypto_adapter 
*adapter,
                        cdev_id = m_data->request_info.cdev_id;
                        qp_id = m_data->request_info.queue_pair_id;
                        qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id];
-                       if (!qp_info->qp_enabled) {
+                       if ((qp_info == NULL) || (!qp_info->qp_enabled)) {
                                rte_pktmbuf_free(crypto_op->sym->m_src);
                                rte_crypto_op_free(crypto_op);
                                continue;
@@ -372,7 +372,7 @@ eca_enq_to_cryptodev(struct rte_event_crypto_adapter 
*adapter,
                        cdev_id = m_data->request_info.cdev_id;
                        qp_id = m_data->request_info.queue_pair_id;
                        qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id];
-                       if (!qp_info->qp_enabled) {
+                       if ((qp_info == NULL) || (!qp_info->qp_enabled)) {
                                rte_pktmbuf_free(crypto_op->sym->m_src);
                                rte_crypto_op_free(crypto_op);
                                continue;
-- 
2.17.2

Reply via email to