From patchwork Thu Sep 21 11:48:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 131787 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0FBCB425DE; Thu, 21 Sep 2023 13:49:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 621DE40F35; Thu, 21 Sep 2023 13:48:49 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 8B0BD40EF1 for ; Thu, 21 Sep 2023 13:48:47 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38LBSDAg018592 for ; Thu, 21 Sep 2023 04:48:47 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=uqTabDzsjEFXvx4Ze65SEX7QLlfAzJ8hcrlEhHHOcWo=; b=TR6paoDxMEDng8s7aD5Fb35Z4wwJn4m0q0+xMGJfjPnRSdUuo4jVVgIvshx1Geop5wiq YYdlCzZFBPYnKTb2HKSiitflic1qMFFsJI/IIcmDb+soOpixgVwguBRrq+brzSILKfkl 4LEMhaw1Pxm/x6wZGZaRT45toQdu8Lq2tRxBUkyqG+290bmthkdA4XhnvuU1LQue6HNN 2/yop6CuJQp2Z71IpfK9EhzCBA7RVhH0EHChAv7dZBqshSwxHF7jgIGqt5iemGZrnqzC eOmcoDrZqPgNVRL0Ctmm8WaTHL9Pf6rc+v59sqsw/FkL/7A89FujBLdrBkwNFnn9pW3F pA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t85ptu0e3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 21 Sep 2023 04:48:46 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 21 Sep 2023 04:48:44 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 21 Sep 2023 04:48:44 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 707A85B693B; Thu, 21 Sep 2023 04:48:42 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Vidya Sagar Velumuri , Anoob Joseph , Aakash Sasidharan , Gowrishankar Muthukrishnan , Subject: [PATCH 08/15] crypto/cnxk: fix control flow issues Date: Thu, 21 Sep 2023 17:18:13 +0530 Message-ID: <20230921114820.2526810-9-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230921114820.2526810-1-ktejasree@marvell.com> References: <20230921114820.2526810-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: YJ6xdGnO_Z2sLOMAWj82uyBZvh7rGN5V X-Proofpoint-ORIG-GUID: YJ6xdGnO_Z2sLOMAWj82uyBZvh7rGN5V X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-21_09,2023-09-21_01,2023-05-22_02 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 From: Vidya Sagar Velumuri 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 --- 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; } }