From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <kirankumark@marvell.com>, <hkalra@marvell.com>,
<jerinj@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com>,
<stable@dpdk.org>
Subject: [PATCH v1] common/cnxk: fix integer overflow
Date: Thu, 18 Jul 2024 12:04:37 +0530 [thread overview]
Message-ID: <20240718063437.557134-1-adwivedi@marvell.com> (raw)
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 <adwivedi@marvell.com>
---
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
next reply other threads:[~2024-07-18 6:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 6:34 Ankur Dwivedi [this message]
2024-07-22 17:39 ` Jerin Jacob
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240718063437.557134-1-adwivedi@marvell.com \
--to=adwivedi@marvell.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).