DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tejasree Kondoj <ktejasree@marvell.com>
To: Akhil Goyal <gakhil@marvell.com>
Cc: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>,
	Aakash Sasidharan <asasidharan@marvell.com>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>,
	<dev@dpdk.org>
Subject: [PATCH v2 08/15] crypto/cnxk: fix control flow issues
Date: Tue, 26 Sep 2023 11:28:40 +0530	[thread overview]
Message-ID: <20230926055847.2707473-9-ktejasree@marvell.com> (raw)
In-Reply-To: <20230926055847.2707473-1-ktejasree@marvell.com>

From: Vidya Sagar Velumuri <vvelumuri@marvell.com>

This patch fixes below coverity issues.

Coverity issue: 393678
Fixes: 21c1c303148b ("crypto/cnxk: support SM4")

Coverity issue: 393679
Fixes: 21c1c303148b ("crypto/cnxk: support SM4")

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
 drivers/crypto/cnxk/cnxk_se.h | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h
index edd929d330..bf70b0a57c 100644
--- a/drivers/crypto/cnxk/cnxk_se.h
+++ b/drivers/crypto/cnxk/cnxk_se.h
@@ -1070,7 +1070,6 @@ cpt_sm_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_p
 		iv_len = 0;
 
 	encr_offset += iv_len;
-	enc_dlen = encr_data_len + encr_offset;
 	enc_dlen = RTE_ALIGN_CEIL(encr_data_len, 8) + encr_offset;
 
 	inputlen = enc_dlen;
@@ -2543,11 +2542,6 @@ fill_sm_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
 	char src[SRC_IOV_SIZE];
 	char dst[SRC_IOV_SIZE];
 	void *mdata = NULL;
-#ifdef CPT_ALWAYS_USE_SG_MODE
-	uint8_t inplace = 0;
-#else
-	uint8_t inplace = 1;
-#endif
 	uint32_t flags = 0;
 	int ret;
 
@@ -2577,11 +2571,9 @@ fill_sm_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
 
 	fc_params.ctx = &sess->roc_se_ctx;
 
-	if (likely(!m_dst && inplace)) {
+	if (m_dst == NULL) {
 		fc_params.dst_iov = fc_params.src_iov = (void *)src;
-
 		prepare_iov_from_pkt_inplace(m_src, &fc_params, &flags);
-
 	} else {
 		/* Out of place processing */
 		fc_params.src_iov = (void *)src;
@@ -2594,14 +2586,10 @@ fill_sm_params(struct rte_crypto_op *cop, struct cnxk_se_sess *sess,
 			goto err_exit;
 		}
 
-		if (unlikely(m_dst != NULL)) {
-			if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) {
-				plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst);
-				ret = -EINVAL;
-				goto err_exit;
-			}
-		} else {
-			fc_params.dst_iov = (void *)src;
+		if (prepare_iov_from_pkt(m_dst, fc_params.dst_iov, 0)) {
+			plt_dp_err("Prepare dst iov failed for m_dst %p", m_dst);
+			ret = -EINVAL;
+			goto err_exit;
 		}
 	}
 
-- 
2.25.1


  parent reply	other threads:[~2023-09-26  5:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  5:58 [PATCH v2 00/15] fixes and improvements to cnxk crypto PMD Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 01/15] crypto/cnxk: clear rptr and dptr fields Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 02/15] common/cnxk: update SE context fields to match ucode spec Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 03/15] common/cnxk: set cipher key only for non-null cipher Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 04/15] crypto/cnxk: update private key length in ECDSA param Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 05/15] crypto/cnxk: fix IPsec CCM and GCM capabilities Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 06/15] crypto/cnxk: remove pdcp chain bit from capabilities Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 07/15] crypto/cnxk: check for sg version in SE engine capabilities Tejasree Kondoj
2023-09-26  5:58 ` Tejasree Kondoj [this message]
2023-09-26  5:58 ` [PATCH v2 09/15] crypto/cnxk: make IV pointers as constant Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 10/15] crypto/cnxk: set PDCP chain IV offset based on FVC Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 11/15] crypto/cnxk: minor shuffling in the sess structure Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 12/15] crypto/cnxk: add support for packets with cipher len zero Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 13/15] crypto/cnxk: add support for raw APIs Tejasree Kondoj
2023-10-10 19:36   ` Thomas Monjalon
2023-10-11  7:23     ` [EXT] " Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 14/15] crypto/cnxk: update the iv from proper param for gmac Tejasree Kondoj
2023-09-26  5:58 ` [PATCH v2 15/15] test/crypto: enable raw crypto tests for crypto_cn10k Tejasree Kondoj
2023-09-26  8:55 ` [PATCH v2 00/15] fixes and improvements to cnxk crypto PMD Anoob Joseph
2023-09-26 14:28 ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926055847.2707473-9-ktejasree@marvell.com \
    --to=ktejasree@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=asasidharan@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=gmuthukrishn@marvell.com \
    --cc=vvelumuri@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).