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 6297045642 for ; Thu, 18 Jul 2024 08:34:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 55301427B6; Thu, 18 Jul 2024 08:34:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1D8074065C; Thu, 18 Jul 2024 08:34:49 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 46I2XZKV009874; Wed, 17 Jul 2024 23:34:48 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=r5s9F7PR7L07owa4BEB9aCQ XGvSaMTs5X+Mqr6iVKyo=; b=bZ/YSbkWb/2qihiWAIpT7ccT62svVn/eg6obAVS /i5CFRHlDBvazYvqOfgW1Ca8j1s/AMuqtTKGdYJUtWHaW2Yen4mLjVO+BVnjQt1d 9OPB3zSjoEZ+TOnOOUcvAYZhxjbbHwLMqFNPdwo0BYBeGLDKqL87G4Snk0CoGMb1 dS1qJHQTiA7j02ve380MXoS70BAj2QcCRjhcENjWPN663QoXwsR1JpBTIAxcoe4B io6sYHJT2FDunfOVe+YuCUdp1WEAHfPGrxIa6U0aoeMiSba1I9kdqvIx3LGAtcUV GEjO5tx/QLqHh+VPUVN+XTmn2BDgbKspYAX33qK7q1A42wQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 40etby0n73-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jul 2024 23:34:48 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 17 Jul 2024 23:34:47 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 17 Jul 2024 23:34:47 -0700 Received: from localhost.localdomain (unknown [10.28.36.185]) by maili.marvell.com (Postfix) with ESMTP id 747213F7053; Wed, 17 Jul 2024 23:34:45 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , Ankur Dwivedi , Subject: [PATCH v1] common/cnxk: fix integer overflow Date: Thu, 18 Jul 2024 12:04:37 +0530 Message-ID: <20240718063437.557134-1-adwivedi@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: -m00U0gYRH9aYJzt3GEWfDyAh6uO_349 X-Proofpoint-GUID: -m00U0gYRH9aYJzt3GEWfDyAh6uO_349 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-07-18_03,2024-07-17_02,2024-05-17_01 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org The expression flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US is evaluated using 32 bit arithmetic. An integer overflow may occur when the value is too large to fit in 32 bits. This patch resolves this by casting flow_age->aging_poll_freq to 64 bit. Coverity issue: 428156 Fixes: a4878294318e ("common/cnxk: fix flow aging on application exit") Cc: stable@dpdk.org Signed-off-by: Ankur Dwivedi --- drivers/common/cnxk/roc_npc_aging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_npc_aging.c b/drivers/common/cnxk/roc_npc_aging.c index 1e85033e2a..258c15e341 100644 --- a/drivers/common/cnxk/roc_npc_aging.c +++ b/drivers/common/cnxk/roc_npc_aging.c @@ -145,7 +145,7 @@ npc_age_wait_until(struct roc_npc_flow_age *flow_age) plt_delay_us(sleep); timeout += sleep; } while (!flow_age->aged_flows_get_thread_exit && - (timeout < (flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US))); + (timeout < ((uint64_t)flow_age->aging_poll_freq * NPC_AGE_WAIT_TIMEOUT_US))); } uint32_t -- 2.25.1