DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Lyulin <lyulin.2003@mail.ru>
To: Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	Somnath Kotur <somnath.kotur@broadcom.com>,
	Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Cc: dev@dpdk.org, stable@dpdk.org, Denis Lyulin <lyulin.2003@mail.ru>
Subject: [PATCH] net/bnxt: add cast to wider type before multiplication
Date: Fri, 17 Apr 2026 08:23:33 +0300	[thread overview]
Message-ID: <20260417052334.2217652-1-lyulin.2003@mail.ru> (raw)

Some static analyzers generate warnings about possible integer
overflow on multiplication. The first parameter of
`rte_eal_alarm_set()` is `uint64_t`, so this commit adds cast
of `uint32_t` values before the multiplication to prevent overflow.
The fix is cosmetic.

Fixes: 9d0cbaecc91a ("net/bnxt: support periodic FW health monitoring")
Cc: kalesh-anakkur.purayil@broadcom.com
Cc: stable@dpdk.org

Signed-off-by: Denis Lyulin <lyulin.2003@mail.ru>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b677f9491d..bdfab3eef2 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4861,7 +4861,7 @@ static void bnxt_dev_recover(void *arg)
 void bnxt_dev_reset_and_resume(void *arg)
 {
 	struct bnxt *bp = arg;
-	uint32_t us = US_PER_MS * bp->fw_reset_min_msecs;
+	uint64_t us = US_PER_MS * (uint64_t)bp->fw_reset_min_msecs;
 	uint16_t val = 0;
 	int rc;
 
@@ -5008,7 +5008,7 @@ static void bnxt_check_fw_health(void *arg)
 
 	info->last_reset_counter = val;
 
-	rte_eal_alarm_set(US_PER_MS * info->driver_polling_freq,
+	rte_eal_alarm_set(US_PER_MS * (uint64_t)info->driver_polling_freq,
 			  bnxt_check_fw_health, (void *)bp);
 
 	return;
@@ -5030,7 +5030,7 @@ static void bnxt_check_fw_health(void *arg)
 	else
 		wait_msec = info->normal_func_wait_period;
 
-	rte_eal_alarm_set(US_PER_MS * wait_msec,
+	rte_eal_alarm_set(US_PER_MS * (uint64_t)wait_msec,
 			  bnxt_fw_reset_cb, (void *)bp);
 }
 
@@ -5048,7 +5048,7 @@ void bnxt_schedule_fw_health_check(struct bnxt *bp)
 
 	polling_freq = bp->recovery_info->driver_polling_freq;
 
-	rte_eal_alarm_set(US_PER_MS * polling_freq,
+	rte_eal_alarm_set(US_PER_MS * (uint64_t)polling_freq,
 			  bnxt_check_fw_health, (void *)bp);
 	bp->flags |= BNXT_FLAG_FW_HEALTH_CHECK_SCHEDULED;
 
-- 
2.34.1


             reply	other threads:[~2026-04-24  7:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-17  5:23 Denis Lyulin [this message]
2026-04-17 16:46 ` [PATCH] net/bnxt: add cast to wider type before multiplication Kishore Padmanabha
     [not found]   ` <1784799383.856929464@f128.i.mail.ru>
2026-07-23 16:36     ` Kishore Padmanabha

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=20260417052334.2217652-1-lyulin.2003@mail.ru \
    --to=lyulin.2003@mail.ru \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=somnath.kotur@broadcom.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