crypto/ipsec_mb: fix null checks

This patch fix the NULL pointer check when dereference qp
and ring lookup.

Coverity issue: 381625
Fixes: c75542ae4200 ("crypto/ipsec_mb: introduce IPsec_mb framework")
Cc: stable@dpdk.org

Signed-off-by: Kai Ji <kai.ji@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
This commit is contained in:
Kai Ji 2022-11-01 22:07:18 +08:00 committed by Akhil Goyal
parent a62ac101fe
commit 16d6ebb65d

View File

@ -141,12 +141,13 @@ ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
struct ipsec_mb_qp *qp = dev->data->queue_pairs[qp_id];
struct rte_ring *r = NULL;
if (qp != NULL)
if (!qp)
return 0;
if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
r = rte_ring_lookup(qp->name);
rte_ring_free(r);
if (r)
rte_ring_free(r);
#if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM
if (qp->mb_mgr)