DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/bnxt: add cast to wider type before multiplication
@ 2026-04-17  5:23 Denis Lyulin
  2026-04-17 16:46 ` Kishore Padmanabha
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Lyulin @ 2026-04-17  5:23 UTC (permalink / raw)
  To: Kishore Padmanabha, Ajit Khaparde, Somnath Kotur, Kalesh AP
  Cc: dev, stable, Denis Lyulin

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net/bnxt: add cast to wider type before multiplication
  2026-04-17  5:23 [PATCH] net/bnxt: add cast to wider type before multiplication Denis Lyulin
@ 2026-04-17 16:46 ` Kishore Padmanabha
       [not found]   ` <1784799383.856929464@f128.i.mail.ru>
  0 siblings, 1 reply; 3+ messages in thread
From: Kishore Padmanabha @ 2026-04-17 16:46 UTC (permalink / raw)
  To: Denis Lyulin; +Cc: Ajit Khaparde, Kalesh AP, dev, stable


[-- Attachment #1.1: Type: text/plain, Size: 2377 bytes --]

On Fri, Apr 17, 2026 at 1:23 AM Denis Lyulin <lyulin.2003@mail.ru> wrote:

> 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>
>
Acked-by:  Kishore Padmanabha <kishore.padmanabha@broadcom.com>

> ---
>  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
>
>

[-- Attachment #1.2: Type: text/html, Size: 3427 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5493 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] net/bnxt: add cast to wider type before multiplication
       [not found]   ` <1784799383.856929464@f128.i.mail.ru>
@ 2026-07-23 16:36     ` Kishore Padmanabha
  0 siblings, 0 replies; 3+ messages in thread
From: Kishore Padmanabha @ 2026-07-23 16:36 UTC (permalink / raw)
  To: Денис Люлин
  Cc: Ajit Kumar Khaparde, dev, stable


[-- Attachment #1.1: Type: text/plain, Size: 2962 bytes --]

Hi Denis,



Accepted the change, should be merged in next cycle.



Thanks,

Kishore





*From:* Денис Люлин <lyulin.2003@mail.ru>
*Sent:* Thursday, July 23, 2026 5:36 AM
*To:* Kishore Padmanabha <kishore.padmanabha@broadcom.com>
*Cc:* Ajit Khaparde <ajit.khaparde@broadcom.com>; Kalesh AP <
kalesh-anakkur.purayil@broadcom.com>; dev@dpdk.org; stable@dpdk.org
*Subject:* Re: [PATCH] net/bnxt: add cast to wider type before
multiplication



Kindly reminder
Sorry, But nobody has reviewed my small cosmetic patch on Patchwork
https://patches.dpdk.org/project/dpdk/patch/20260417052334.2217652-1-lyulin.2003@mail.ru/
Could you please review this?





On Fri, Apr 17, 2026 at 1:23 AM Denis Lyulin <lyulin.2003@mail.ru> wrote:

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>

Acked-by:  Kishore Padmanabha <kishore.padmanabha@broadcom.com>

---
 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

[-- Attachment #1.2: Type: text/html, Size: 6622 bytes --]

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5493 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-23 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-17  5:23 [PATCH] net/bnxt: add cast to wider type before multiplication Denis Lyulin
2026-04-17 16:46 ` Kishore Padmanabha
     [not found]   ` <1784799383.856929464@f128.i.mail.ru>
2026-07-23 16:36     ` Kishore Padmanabha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox