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 11C88432C7; Tue, 7 Nov 2023 15:12:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FCA3402B5; Tue, 7 Nov 2023 15:12:14 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 508C3402A1 for ; Tue, 7 Nov 2023 15:12:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699366332; x=1730902332; h=from:to:subject:date:message-id:references:in-reply-to: mime-version; bh=Kof5gh+3a8eP8TpLFJfqpUwC3RflBZhbVCVMBzE8lHg=; b=WebecBtb8FHP1cIRTDCXhsz8xpnEvckzoU/MVkK3UowYffTFZHnFwHkp qJkqFJSraUF9kmuM5S3LFBU3ZEPNgKZCNKBpLJfGw7pY+nvoFsckw+xDq Tez3wQOnkQNYsFhUj8zWgcGhXkpVTQPYsOr14o1f5TH/HMnQStoIkvKq5 fz7aq1spPmTP+CLW+7dsQPG/tLvxs65CmVKxuEhR1l9wZdPvcyAht9xiP umI4C2adZFCDQI+n9O5/GIWvhWcn3lSL2die++PZypwCvpnFdZcU+aFVx EQu5h04HONWZFMkYYSyTy+UmcatF9ftLZXHiSv4Rffi4MBmHu2oOCv/4D w==; X-IronPort-AV: E=McAfee;i="6600,9927,10887"; a="388389279" X-IronPort-AV: E=Sophos;i="6.03,283,1694761200"; d="scan'208,217";a="388389279" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2023 06:12:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10887"; a="906429401" X-IronPort-AV: E=Sophos;i="6.03,283,1694761200"; d="scan'208,217";a="906429401" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 07 Nov 2023 06:12:09 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 7 Nov 2023 06:12:09 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 7 Nov 2023 06:12:08 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Tue, 7 Nov 2023 06:12:08 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Tue, 7 Nov 2023 06:12:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gq5qKxW+4btZQi0JpOBCNKNSkjdUyC1uNcDSzsowoksGDQz38W1NN/2fqCwiWOa/t2lZcpdvaOUEawMNbtrn9wJrSmRK6G323rsDTEa4CtmKlnXrjLgMifHt8iJjjFidPczQGi5kIvZKVAvwBRsn53bSOekIh4aWEf5Fywzz4fot0av1TBYK/yI18unZc0Rk3c9Gcj/59EXTVBEr/5HNS4oIs1Vinw8IjTxGysxGoUNMXLgxmnQZuOIHRz8jPtSmO45TwMHOfodSj2TpGIpYWm0yi5u6C/OkSW6F2uXeDZ/S/h6GxiDpO3wNAY3hCt3TKZJjzUFVyxyynVbnpRZ7sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1oLL25l/8E5YdG7XzOPMBBW+ARNiaAllYqB2TAYHh1g=; b=NQvL4VjZ1IEz2JluWIIYGdD9z1OfHXbLVnu4s9oG5T+2z1k8T43nVlaNJSjWYPchdBTmk7OxTuJP6xo5KXZxLPEtKZ2iNUwadsTpiEpS84s8UauvboYQSJWokF47ujh2cRXTit6w2CureNPc7ulyRJ3dyh++ePuA0nhMyJgISfkr6/e2ZP/GHzNBhd10OQxeUG6bkvTPUz47wBBUZ5VEB4BU+3xMHyH5j7kO52LPyyOhVgau9ndwYU6wfvjAliEMBDSiZ+Hqa/Qd1vnwxGMwrMpeTTYOq7C3Zz1d9p3jlW4PZu7/bm81wxt2grTkNCYsYrhw4+CNsn7zlwBNHtVV+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SN6PR11MB3408.namprd11.prod.outlook.com (2603:10b6:805:bc::22) by CY5PR11MB6162.namprd11.prod.outlook.com (2603:10b6:930:29::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.25; Tue, 7 Nov 2023 14:12:06 +0000 Received: from SN6PR11MB3408.namprd11.prod.outlook.com ([fe80::53de:5700:449b:3f25]) by SN6PR11MB3408.namprd11.prod.outlook.com ([fe80::53de:5700:449b:3f25%5]) with mapi id 15.20.6954.030; Tue, 7 Nov 2023 14:12:06 +0000 From: "Ji, Kai" To: Stephen Hemminger , "dev@dpdk.org" Subject: Re: [PATCH 2/2] crypto/openssl: remove unnecessary NULL checks before free Thread-Topic: [PATCH 2/2] crypto/openssl: remove unnecessary NULL checks before free Thread-Index: AQHaDeDv6c6Zwn6AZEmaVxKU0K0CJLBu7N4l Date: Tue, 7 Nov 2023 14:12:06 +0000 Message-ID: References: <20231102230307.6138-1-stephen@networkplumber.org> <20231102230307.6138-3-stephen@networkplumber.org> In-Reply-To: <20231102230307.6138-3-stephen@networkplumber.org> Accept-Language: en-GB, en-US, en-IE Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB3408:EE_|CY5PR11MB6162:EE_ x-ms-office365-filtering-correlation-id: dc460ca6-ab3b-4ac4-4d56-08dbdf9b8623 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ASy9We0krX2hlszuj/es52IU9ZDHTLQ/58iNhM0dDQLxHYoUf8JDKtH9Ga4k20yzejA/qxa6WtJ7su4zKDDTKuMm0Q26RZ+RNFrvJhldpg47yIh9j0t/fZiZQd//WIkZurhFu3V94fM5dQizAWgT9OECJ8bzaBvIJScuc/YHj/3p7qNnpenpUnKUHhjG4zY6CAe0r+RVGOCXO7HE9bFTCecY7AuOvTCvoTAVWVhY0URrz3RbnHR73UZ7AfNj0c5xEVDWjHGDurCKosjYqz1LQ4arIOdAsuDVh0wAfLJyN35zY8LptAHjusrg+YKg1nAiD3XhWmLU6XYx3q53ol/J5duwb9vyrj85Y2+9gAIksSoHTmT8J5qiqrQ7t/GsjbWXCqRM8vZdbeE2mXMvaIa6GBPiK+j+WZEaXIRO1uGqzfKLa3yu4yshoQvCyiGTr2n7TF5queO15WnAqros5F+Zh9LcTUQ/6aMPOmhe+SSAoYJYm2pWVU1/nyZh3F27VMotMUu/9cDyjHMrleNvkqvltAKY6Vw+uUnzHN6Vavfik2SdFAmukwHCLVzW84DBgygQS7W4gYOTO5lq+LxovHPPOssEt721kpIVBisW2a7UJyd+OGAB8qxiGi6W8zBKFuNv x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SN6PR11MB3408.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(346002)(366004)(39860400002)(376002)(136003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(66946007)(478600001)(2906002)(41300700001)(5660300002)(82960400001)(38100700002)(122000001)(86362001)(8676002)(6506007)(8936002)(26005)(83380400001)(9686003)(7696005)(52536014)(71200400001)(76116006)(316002)(66446008)(91956017)(110136005)(66556008)(66476007)(64756008)(53546011)(33656002)(19627405001)(55016003)(38070700009); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?i+fA5kAiO1G5INKh0p2QxImLSKZAmA6DrU3KXroamQuNbeLVseoTGV0s46nw?= =?us-ascii?Q?uzVbip5sQKCNJUxLKsecScn8Tdqjh5NOJ1TL4gOuSwlrsH+2rTQ8ryDp8//W?= =?us-ascii?Q?8Mg7OJU0GBiNag+tFguOyZf3TAPQFfZ+BIwH+Voy+/DLAWT1YHStcwVTBY/b?= =?us-ascii?Q?nnxWM4D9f0v3L0hdCrc1B4Gdx9a+yfW18i0vhvdvo1sGQ3pp6eD6WngBiIwq?= =?us-ascii?Q?8TjkF3qEPFN1lYwQMMTB0rTwdn9S2o4OmHDGjY4dvKCac/l72ugZ8FkMhaIX?= =?us-ascii?Q?j+xv57OcdErpCGlXd0v0G3ZJZexUY3PIBRYcR59qmQN/lJEmSe7+VXuEH65U?= =?us-ascii?Q?4YTzJuzCZdkaSJsfbGQJb2jzHuLYVmvrMY+9In6cpBXKvaBIAUijZ9uRrzOm?= =?us-ascii?Q?QYk5po4pipAIBIFVHTQpd1lpftt4+DDNAPD4G/5cVgDYCCDoHreCxvyTsArz?= =?us-ascii?Q?RHfaRv6/aSIj0HlqM23ljEvNfeXMN+JyYClZS5Z2ytb/Xs9A3GGLLMdP/XL4?= =?us-ascii?Q?/MSJTjSJaB5vlmdGmNj148g683zo3G0DNFsxzQE7Vpa9DeLdW75i6lLwsdwb?= =?us-ascii?Q?Lwm6c2ZWknUg9fjo3GQ2GwXohpArJCYgWTS8q4UULW9g2ocubd0mZb1AG8SC?= =?us-ascii?Q?1JHoLPFAhiHGicn8UgzPzajZzzagy6zoIKMQrvBxABxonaXXIN5D6Y+BOC1c?= =?us-ascii?Q?V96I6rAvv7yC44sVLrfV7ELqrqH6fKn3x01jQ3XN/JuespsAa+4vQW8VsFPe?= =?us-ascii?Q?YBQRFlQT4qR9/VxFOb+msPInnhwJHXGkFywJxHoEcWiBatiVOXDsst0Fs4jN?= =?us-ascii?Q?rH88LgGcepBNQgjJB+To1yqFBb3V/ct4sxH16h3NmbQRW/DFkwythqTmYqTo?= =?us-ascii?Q?BQ0jNLm19HRzBx48j8Y3bob4BLmr0I9lo3ma9+3pOz1xDVz1+QTemyP0FHi+?= =?us-ascii?Q?lpcDc1Aved98K6SyEph3+pBLRfojJRXM+XGJhgikfXzWr0cBLCoMB9bDrvL0?= =?us-ascii?Q?C+bKHcTCuk3HwKFAIhE5Ay3/uAX/2cVsS3QJ+OK9OJRb1LsF6uIzJ5K8ua8l?= =?us-ascii?Q?k1qjzkV4aZzuMYp1N0+tQB5jFTuqTPwT7uRvK7zamPl/DbiVZx9imHsEIo85?= =?us-ascii?Q?uIDcZ70B7UsQ+EgFdMIAtDS8HNSKNdhVHTqOWU1z/s9vPIXmtMjVwnvtjgCm?= =?us-ascii?Q?6Me0Bv/VeZ9MljRp5N2wB+U3a2oiYYrcDbbkt9dfenXvH/K9RP/d58t1D2Ag?= =?us-ascii?Q?UHR77lwsQjOzvUy0YRMDdXqJNwF3SnebmVtgYCo8QlSC/WUX+KjvJVvueb3S?= =?us-ascii?Q?inpJ1mPaHXJxkHAvhepOOFLQU6W5KQP3cPd3/l4TR+IHx2OAdPqpP4DyY1z3?= =?us-ascii?Q?zGEzDiNBt0HQ4KYMKVLSrXCX53BHeTXmgUf/llunjc1ydaItdE1ZQq8q/DzC?= =?us-ascii?Q?AcLjdRRotuvFI3NgqIqXR+tt3INzCo5MmFDUl6Ef/xcyHp20U40xKt8y54jD?= =?us-ascii?Q?wOXLeyliJQT5Wn9GpwNOkN9j1VTowfvJm4xx7PNnJQN2jWtiosIkFyob7yG2?= =?us-ascii?Q?HifGV/1h/tubrmpemHE=3D?= Content-Type: multipart/alternative; boundary="_000_SN6PR11MB3408870A278361D0713AA54781A9ASN6PR11MB3408namp_" MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB3408.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc460ca6-ab3b-4ac4-4d56-08dbdf9b8623 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Nov 2023 14:12:06.6033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 8X9RbcDiJcm+ANr60skG/FCkgoGSAX2CDZemQtcaUv7wYbk7+3jJ4BRxe3ydh41BERegtJkiygmxo+Mvl9grCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6162 X-OriginatorOrg: intel.com 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 --_000_SN6PR11MB3408870A278361D0713AA54781A9ASN6PR11MB3408namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Acked-by: Kai Ji ________________________________ From: Stephen Hemminger Sent: 02 November 2023 23:02 To: dev@dpdk.org Cc: Stephen Hemminger ; Ji, Kai Subject: [PATCH 2/2] crypto/openssl: remove unnecessary NULL checks before = free Found with nullfree.cocci Signed-off-by: Stephen Hemminger --- drivers/crypto/openssl/rte_openssl_pmd.c | 36 +++++++------------- drivers/crypto/openssl/rte_openssl_pmd_ops.c | 3 +- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/open= ssl/rte_openssl_pmd.c index c234882417..090320602d 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -1957,10 +1957,8 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op= *cop, err_dsa_sign: if (params) OSSL_PARAM_free(params); - if (key_ctx) - EVP_PKEY_CTX_free(key_ctx); - if (dsa_ctx) - EVP_PKEY_CTX_free(dsa_ctx); + EVP_PKEY_CTX_free(key_ctx); + EVP_PKEY_CTX_free(dsa_ctx); return -1; } @@ -2039,10 +2037,8 @@ process_openssl_dsa_verify_op_evp(struct rte_crypto_= op *cop, DSA_SIG_free(sign); if (params) OSSL_PARAM_free(params); - if (key_ctx) - EVP_PKEY_CTX_free(key_ctx); - if (dsa_ctx) - EVP_PKEY_CTX_free(dsa_ctx); + EVP_PKEY_CTX_free(key_ctx); + EVP_PKEY_CTX_free(dsa_ctx); return ret; } @@ -2294,16 +2290,12 @@ process_openssl_dh_op_evp(struct rte_crypto_op *cop= , ret =3D 0; err_dh: - if (pub_key) - BN_free(pub_key); - if (priv_key) - BN_free(priv_key); + BN_free(pub_key); + BN_free(priv_key); if (params) OSSL_PARAM_free(params); - if (dhpkey) - EVP_PKEY_free(dhpkey); - if (peerkey) - EVP_PKEY_free(peerkey); + EVP_PKEY_free(dhpkey); + EVP_PKEY_free(peerkey); EVP_PKEY_CTX_free(dh_ctx); @@ -2880,17 +2872,13 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *co= p, ret =3D 0; cop->status =3D RTE_CRYPTO_OP_STATUS_SUCCESS; err_sm2: - if (kctx) - EVP_PKEY_CTX_free(kctx); + EVP_PKEY_CTX_free(kctx); - if (sctx) - EVP_PKEY_CTX_free(sctx); + EVP_PKEY_CTX_free(sctx); - if (cctx) - EVP_PKEY_CTX_free(cctx); + EVP_PKEY_CTX_free(cctx); - if (pkey) - EVP_PKEY_free(pkey); + EVP_PKEY_free(pkey); return ret; } diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/= openssl/rte_openssl_pmd_ops.c index 2862c294a9..419a767817 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c +++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c @@ -1431,8 +1431,7 @@ static void openssl_reset_asym_session(struct openssl= _asym_session *sess) switch (sess->xfrm_type) { case RTE_CRYPTO_ASYM_XFORM_RSA: #if (OPENSSL_VERSION_NUMBER >=3D 0x30000000L) - if (sess->u.r.ctx) - EVP_PKEY_CTX_free(sess->u.r.ctx); + EVP_PKEY_CTX_free(sess->u.r.ctx); #else if (sess->u.r.rsa) RSA_free(sess->u.r.rsa); -- 2.41.0 --_000_SN6PR11MB3408870A278361D0713AA54781A9ASN6PR11MB3408namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Acked-by: Kai Ji <kai.j= i@intel.com>

From: Stephen Hemminger <= ;stephen@networkplumber.org>
Sent: 02 November 2023 23:02
To: dev@dpdk.org <dev@dpdk.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>; Ji, Kai &l= t;kai.ji@intel.com>
Subject: [PATCH 2/2] crypto/openssl: remove unnecessary NULL checks = before free
 
Found with nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/crypto/openssl/rte_openssl_pmd.c     | 36= +++++++-------------
 drivers/crypto/openssl/rte_openssl_pmd_ops.c |  3 +-
 2 files changed, 13 insertions(+), 26 deletions(-)

diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/open= ssl/rte_openssl_pmd.c
index c234882417..090320602d 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd.c
@@ -1957,10 +1957,8 @@ process_openssl_dsa_sign_op_evp(struct rte_crypto_op= *cop,
 err_dsa_sign:
         if (params)
            &nb= sp;    OSSL_PARAM_free(params);
-       if (key_ctx)
-            &n= bsp;  EVP_PKEY_CTX_free(key_ctx);
-       if (dsa_ctx)
-            &n= bsp;  EVP_PKEY_CTX_free(dsa_ctx);
+       EVP_PKEY_CTX_free(key_ctx);
+       EVP_PKEY_CTX_free(dsa_ctx);
         return -1;
 }
 
@@ -2039,10 +2037,8 @@ process_openssl_dsa_verify_op_evp(struct rte_crypto_= op *cop,
            &nb= sp;    DSA_SIG_free(sign);
         if (params)
            &nb= sp;    OSSL_PARAM_free(params);
-       if (key_ctx)
-            &n= bsp;  EVP_PKEY_CTX_free(key_ctx);
-       if (dsa_ctx)
-            &n= bsp;  EVP_PKEY_CTX_free(dsa_ctx);
+       EVP_PKEY_CTX_free(key_ctx);
+       EVP_PKEY_CTX_free(dsa_ctx);
 
         return ret;
 }
@@ -2294,16 +2290,12 @@ process_openssl_dh_op_evp(struct rte_crypto_op *cop= ,
         ret =3D 0;
 
  err_dh:
-       if (pub_key)
-            &n= bsp;  BN_free(pub_key);
-       if (priv_key)
-            &n= bsp;  BN_free(priv_key);
+       BN_free(pub_key);
+       BN_free(priv_key);
         if (params)
            &nb= sp;    OSSL_PARAM_free(params);
-       if (dhpkey)
-            &n= bsp;  EVP_PKEY_free(dhpkey);
-       if (peerkey)
-            &n= bsp;  EVP_PKEY_free(peerkey);
+       EVP_PKEY_free(dhpkey);
+       EVP_PKEY_free(peerkey);
 
         EVP_PKEY_CTX_free(dh_ctx);=
 
@@ -2880,17 +2872,13 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *co= p,
         ret =3D 0;
         cop->status =3D RTE_CRY= PTO_OP_STATUS_SUCCESS;
 err_sm2:
-       if (kctx)
-            &n= bsp;  EVP_PKEY_CTX_free(kctx);
+       EVP_PKEY_CTX_free(kctx);
 
-       if (sctx)
-            &n= bsp;  EVP_PKEY_CTX_free(sctx);
+       EVP_PKEY_CTX_free(sctx);
 
-       if (cctx)
-            &n= bsp;  EVP_PKEY_CTX_free(cctx);
+       EVP_PKEY_CTX_free(cctx);
 
-       if (pkey)
-            &n= bsp;  EVP_PKEY_free(pkey);
+       EVP_PKEY_free(pkey);
 
         return ret;
 }
diff --git a/drivers/crypto/openssl/rte_openssl_pmd_ops.c b/drivers/crypto/= openssl/rte_openssl_pmd_ops.c
index 2862c294a9..419a767817 100644
--- a/drivers/crypto/openssl/rte_openssl_pmd_ops.c
+++ b/drivers/crypto/openssl/rte_openssl_pmd_ops.c
@@ -1431,8 +1431,7 @@ static void openssl_reset_asym_session(struct openssl= _asym_session *sess)
         switch (sess->xfrm_type= ) {
         case RTE_CRYPTO_ASYM_XFORM= _RSA:
 #if (OPENSSL_VERSION_NUMBER >=3D 0x30000000L)
-            &n= bsp;  if (sess->u.r.ctx)
-            &n= bsp;          EVP_PKEY_CTX_fre= e(sess->u.r.ctx);
+            &n= bsp;  EVP_PKEY_CTX_free(sess->u.r.ctx);
 #else
            &nb= sp;    if (sess->u.r.rsa)
            &nb= sp;            RSA_f= ree(sess->u.r.rsa);
--
2.41.0

--_000_SN6PR11MB3408870A278361D0713AA54781A9ASN6PR11MB3408namp_--