From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C7376A00C2; Tue, 1 Nov 2022 15:07:33 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5F24840693; Tue, 1 Nov 2022 15:07:33 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id EBC1840223 for ; Tue, 1 Nov 2022 15:07:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667311651; x=1698847651; h=from:to:cc:subject:date:message-id; bh=YmfiDHiRoU0h2PUf3fegBIqGMLHR55exZHqdZbiSRxc=; b=I6Gi7ZDcW1BS4eyFBHlOzb+tT7grbv2zg7KtvrWZH4CZeznwZWSm4sCU EhGge7+FK1j9sAacHaWFxhoSPilzIatMuolVAfdAgH2SZDcQFyZXwR19i TIVzGKv92neb1LODFeLvmWPQVDwFAzSmG9MvZuDeb9B70HDFO0AhPvYoQ +tb5aT+uTzFnmmg+U/8lpFYLA165aIWhLRQKtr3LcJvlEwqGX/PPbLFvc Hb7j8GbarC8Xie5FI8+vMUAhpFakXcht+pKVKUERJ0+D69Dd1BRjUaez2 +DcjqLOZRMA9ee0qZga+rCoGcqO1bXCN2YkBQxJEkYJmA0IpYhCBfIMdF A==; X-IronPort-AV: E=McAfee;i="6500,9779,10518"; a="306755979" X-IronPort-AV: E=Sophos;i="5.95,231,1661842800"; d="scan'208";a="306755979" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2022 07:07:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10518"; a="739338082" X-IronPort-AV: E=Sophos;i="5.95,231,1661842800"; d="scan'208";a="739338082" Received: from silpixa00400465.ir.intel.com ([10.55.128.22]) by fmsmga002.fm.intel.com with ESMTP; 01 Nov 2022 07:07:20 -0700 From: Kai Ji To: dev@dpdk.org Cc: gakhil@marvell.com, Kai Ji , roy.fan.zhang@intel.com, Pablo de Lara , Ray Kinsella , Ciara Power Subject: [dpdk-dev v1] crypto/ipsec_mb: fix of qp NULL check Date: Tue, 1 Nov 2022 22:07:18 +0800 Message-Id: <20221101140718.15825-1-kai.ji@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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: roy.fan.zhang@intel.com Signed-off-by: Kai Ji --- drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c index bf18d692bd..7bb3e4d46c 100644 --- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c +++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c @@ -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) -- 2.17.1