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 23DA0A0C47; Mon, 26 Jul 2021 06:44:31 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB6C840F35; Mon, 26 Jul 2021 06:44:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E344F40DDA for ; Mon, 26 Jul 2021 06:44:27 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16Q4ZHXv028382 for ; Sun, 25 Jul 2021 21:44:27 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=vLgyTYYJhL+cyN5I0M2dZcQxNhI8eZyNx5fcy8wDS8g=; b=L0qYCHKT1rBN/64kWUa6CRQFjLz2vH2+6ZE4vN5ntQM/+B/4mhTPwz2Vk5LPQWyBIdKp m+HQhx0xwlmZDKzrqg1vQXD5Ar8B0CfFjAPsevW+oFAuiD5Z8xux7uGgMduPEcAe4G9F 61vpqdR4XEpalBFNgl6tynMaTKZqGpKuobueuB+Zp8bjO2mMpv+tg8WpKe+TGkCXtlA2 5zvoiFViAbBvn2Vs3bozoKOt85vIMWCQ0Ew97Yqqtgv9udULEh8XwRgsufUpbdc+Av2s P6dDj8gSfVNYMqaFqOG3AOdhprL7WdOFHX2Z4SYqWHIk9yvCwkGWZ0aKbu8W1iYDzeo3 ig== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com with ESMTP id 3a1avp9abb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sun, 25 Jul 2021 21:44:26 -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.18; Sun, 25 Jul 2021 21:44:25 -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.18 via Frontend Transport; Sun, 25 Jul 2021 21:44:25 -0700 Received: from localhost.localdomain (unknown [10.28.34.15]) by maili.marvell.com (Postfix) with ESMTP id 03CFA3F705B; Sun, 25 Jul 2021 21:44:23 -0700 (PDT) From: To: Ankur Dwivedi , Anoob Joseph , Tejasree Kondoj CC: , Kiran Kumar K Date: Mon, 26 Jul 2021 10:14:19 +0530 Message-ID: <20210726044419.2231610-1-kirankumark@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: cLI8rHDBu3GD-NspAwaUL2628-DO-WHd X-Proofpoint-ORIG-GUID: cLI8rHDBu3GD-NspAwaUL2628-DO-WHd X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-26_01:2021-07-23, 2021-07-26 signatures=0 Subject: [dpdk-dev] [PATCH] crypto/cnxk: add null check for rsa param key data 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 Sender: "dev" From: Kiran Kumar K Coverity is reporting FORWARD_NULL issue when qt data is NULL. Adding NULL check for this. Coverity issue: 371893 Fixes: 5a3513caeb455 ("crypto/cnxk: add asymmetric session ops") Signed-off-by: Kiran Kumar K --- drivers/crypto/cnxk/cnxk_ae.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/cnxk/cnxk_ae.h b/drivers/crypto/cnxk/cnxk_ae.h index c752e62ea5..a71e7ee8a2 100644 --- a/drivers/crypto/cnxk/cnxk_ae.h +++ b/drivers/crypto/cnxk/cnxk_ae.h @@ -85,6 +85,9 @@ cnxk_ae_fill_rsa_params(struct cnxk_ae_sess *sess, size_t len = (mod_len / 2); uint64_t total_size; + if (qt.p.length != 0 && qt.p.data == NULL) + return -EINVAL; + /* Make sure key length used is not more than mod_len/2 */ if (qt.p.data != NULL) len = RTE_MIN(len, qt.p.length); @@ -109,7 +112,8 @@ cnxk_ae_fill_rsa_params(struct cnxk_ae_sess *sess, rsa->qt.dQ.data = rsa->qt.q.data + qt.q.length; memcpy(rsa->qt.dQ.data, qt.dQ.data, qt.dQ.length); rsa->qt.p.data = rsa->qt.dQ.data + qt.dQ.length; - memcpy(rsa->qt.p.data, qt.p.data, qt.p.length); + if (qt.p.data != NULL) + memcpy(rsa->qt.p.data, qt.p.data, qt.p.length); rsa->qt.dP.data = rsa->qt.p.data + qt.p.length; memcpy(rsa->qt.dP.data, qt.dP.data, qt.dP.length); rsa->qt.qInv.data = rsa->qt.dP.data + qt.dP.length; -- 2.25.1