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 C7539455D0; Wed, 10 Jul 2024 10:56:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 794EB42D76; Wed, 10 Jul 2024 10:55:43 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id D5F17427DF; Wed, 10 Jul 2024 10:55:38 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 992FC20060D; Wed, 10 Jul 2024 10:55:38 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5F7CD2005FA; Wed, 10 Jul 2024 10:55:38 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id AA405183AD0A; Wed, 10 Jul 2024 16:55:37 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Hemant Agrawal , Sachin Saxena , Shreyansh Jain Cc: stable@dpdk.org, Apeksha Gupta , Vanshika Shukla Subject: [v5 4/8] common/dpaax: fix array overrun issue Date: Wed, 10 Jul 2024 14:25:30 +0530 Message-Id: <20240710085534.2564668-5-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240710085534.2564668-1-vanshika.shukla@nxp.com> References: <20240709100505.2476972-1-vanshika.shukla@nxp.com> <20240710085534.2564668-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP 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: Apeksha Gupta Out-of-bounds read, Overrunning dynamic array nodes at offset corresponding to index variable j. Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table") Cc: stable@dpdk.org Signed-off-by: Apeksha Gupta Signed-off-by: Vanshika Shukla --- drivers/common/dpaax/dpaax_iova_table.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c index d2a78f4c19..860e702333 100644 --- a/drivers/common/dpaax/dpaax_iova_table.c +++ b/drivers/common/dpaax/dpaax_iova_table.c @@ -139,10 +139,12 @@ read_memory_node(unsigned int *count) } DPAAX_DEBUG("Device-tree memory node data:"); - do { + + while (j > 0) { + --j; DPAAX_DEBUG(" %08" PRIx64 " %08zu", nodes[j].addr, nodes[j].len); - } while (--j); + } cleanup: close(fd); -- 2.25.1