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 780D043C13; Wed, 28 Feb 2024 07:48:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8811A406FF; Wed, 28 Feb 2024 07:48:15 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id BA89C402AC; Wed, 28 Feb 2024 07:46:51 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41S0ppRI005633; Tue, 27 Feb 2024 22:46:51 -0800 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=ah7btICg OIiu3yRtZHXDRjEpD8gKXca0nQfENN5uphw=; b=WxdZgnr0QC3KZEi5Rb2uVZA4 6jJwbKRiAHh08LO/z7pEdkwrMvqmoG42qwMs1xpKSRTdcz6wtsKT026hT8ipUvRC Pbt9kEktMkwcSTM+RC7NbnE3sfBpqsHxRF7OOTZOwaGTvQwu6//i1PFe9k86YX8O EWM7Uebj8962CYE9t3O6gtNZz6CkysmcspPDYT61dARKOg0kahxgqZnAdp2OtQ5T 81s7n4Cd3NPIJByAsDVNYcmIn84F5V890lm5sQu5/+pR8RT6wPUUS6aTq4aYw/Sm DE/hOuRYJpIMVDLOeF6nHogvDSAB+b0AINQxE3BV9+zAfkXWmVxCbjClJk7QWw== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3whjm6b232-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 22:46:50 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 27 Feb 2024 22:46:50 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Tue, 27 Feb 2024 22:46:50 -0800 Received: from cavium-OptiPlex-3070-BM17.. (unknown [10.28.34.33]) by maili.marvell.com (Postfix) with ESMTP id 111763F7305; Tue, 27 Feb 2024 22:46:46 -0800 (PST) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Jerin Jacob CC: , Satheesh Paul , , Harman Kalra Subject: [dpdk-dev] [PATCH] common/cnxk: fix Coverity issues Date: Wed, 28 Feb 2024 12:16:43 +0530 Message-ID: <20240228064643.1923169-1-psatheesh@marvell.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: t1NTVVoRXJaBwj6FSdYFXVa7w5V37d50 X-Proofpoint-GUID: t1NTVVoRXJaBwj6FSdYFXVa7w5V37d50 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-28_04,2024-02-27_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: Satheesh Paul Fix Out-of-bounds access and remove dead code reported by Coverity. Coverity issue: 384431, 384439, 380992 Fixes: 585bb3e538f9 ("common/cnxk: add VF support to base device class") Fixes: da1ec39060b2 ("common/cnxk: delay inline device RQ enable to dev start") Cc: stable@dpdk.org Signed-off-by: Satheesh Paul Reviewed-by: Nithin Dabilpuram Reviewed-by: Harman Kalra --- drivers/common/cnxk/roc_dev.c | 2 ++ drivers/common/cnxk/roc_nix_inl.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index 084343c3b4..14aff233d5 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -502,6 +502,8 @@ pf_vf_mbox_send_up_msg(struct dev *dev, void *rec_msg) size_t size; size = PLT_ALIGN(mbox_id2size(msg->hdr.id), MBOX_MSG_ALIGN); + if (size < sizeof(struct mbox_msghdr)) + return; /* Send UP message to all VF's */ for (vf = 0; vf < vf_mbox->ndevs; vf++) { /* VF active */ diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index a205c658e9..7dbeae5017 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -677,8 +677,7 @@ roc_nix_reassembly_configure(uint32_t max_wait_time, uint16_t max_frags) return -EFAULT; PLT_SET_USED(max_frags); - if (idev == NULL) - return -ENOTSUP; + roc_cpt = idev->cpt; if (!roc_cpt) { plt_err("Cannot support inline inbound, cryptodev not probed"); -- 2.39.2