From patchwork Mon Jun 19 12:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 128790 X-Patchwork-Delegate: thomas@monjalon.net 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 541BD42CFA; Mon, 19 Jun 2023 14:45:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F0BBA42BC9; Mon, 19 Jun 2023 14:45:38 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 428AD410E4 for ; Mon, 19 Jun 2023 14:45:37 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35JBcNof017112 for ; Mon, 19 Jun 2023 05:45:36 -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=aG+WGALFaxK/aJlcpwpHhoRCGwk7lCUoKOHO+vUh2mc=; b=KbABh48R/U6HmiPhxZGwZhUF/E2vxqZq12EyTilLevc5Bu/BaahmgFygSo3hYzLXI3H/ RUbIQqwmJO5fVVYXj4yX25aLDYfWDvXBJs55uZ6Qffry+0vowp+LmzIoX/R+J1htATWx ytDVNXAgbDgyXi8O1rJ31uJFKYU9D9L8ZHSG6pzG+vSMyVhQUh2SDYRvSMQCqzdzSclC qh6y4b0i6x5JC3+odhKhXvTJbISMZRWD98ZZ3F5V70g1HOUcGKdJ0/br2JoLopVITx/6 Hyc4pxB2zIM+29EoL5ailZQuemcVb7q/7lszGk/GcF1ZIL8w+g0+eo7y4DsAwSe3JQ4L kg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3r9a6n5hkk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 19 Jun 2023 05:45:36 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 19 Jun 2023 05:45:34 -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; Mon, 19 Jun 2023 05:45:34 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 87E595C68F0; Mon, 19 Jun 2023 05:45:32 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal CC: Anoob Joseph , Aakash Sasidharan , Gowrishankar Muthukrishnan , Vidya Sagar Velumuri , Subject: [PATCH 1/8] crypto/cnxk: check for null pointer Date: Mon, 19 Jun 2023 18:15:21 +0530 Message-ID: <20230619124528.3967275-2-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230619124528.3967275-1-ktejasree@marvell.com> References: <20230619124528.3967275-1-ktejasree@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: hLQhkvxPezLYrjyjDi_wDo291W8M4GE7 X-Proofpoint-GUID: hLQhkvxPezLYrjyjDi_wDo291W8M4GE7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-19_09,2023-06-16_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 Checking for NULL pointer dereference. Signed-off-by: Tejasree Kondoj --- drivers/crypto/cnxk/cnxk_se.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index c66ab80749..a85e4c5170 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -2185,12 +2185,14 @@ fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess) if (zsk_flag && sess->roc_se_ctx.auth_then_ciph) { struct rte_crypto_cipher_xform *c_form; - c_form = &xform->next->cipher; - if (c_form->op != RTE_CRYPTO_CIPHER_OP_ENCRYPT && - a_form->op != RTE_CRYPTO_AUTH_OP_GENERATE) { - plt_dp_err("Crypto: PDCP auth then cipher must use" - " options: encrypt and generate"); - return -EINVAL; + if (xform->next != NULL) { + c_form = &xform->next->cipher; + if ((c_form != NULL) && (c_form->op != RTE_CRYPTO_CIPHER_OP_ENCRYPT) && + a_form->op != RTE_CRYPTO_AUTH_OP_GENERATE) { + plt_dp_err("Crypto: PDCP auth then cipher must use" + " options: encrypt and generate"); + return -EINVAL; + } } }