DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
To: dev@dpdk.org
Cc: kishore.padmanabha@broadcom.com, stable@dpdk.org,
	Zoe Cheimets <zoe.cheimets@broadcom.com>,
	Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
Subject: [PATCH 3/4] net/bnxt: remove implicit integer sign-extension
Date: Wed,  3 Jun 2026 11:51:36 -0600	[thread overview]
Message-ID: <20260603175137.1990204-4-Mohammad-Shuab.Siddique@broadcom.com> (raw)
In-Reply-To: <20260603175137.1990204-1-Mohammad-Shuab.Siddique@broadcom.com>

From: Zoe Cheimets <zoe.cheimets@broadcom.com>

In bnxt_ring.c, the result on line 389 was auto-sign extended by
the compiler because the arithmetic result is an int, but the
dpi_offset is uint64_t. Fix by casting the result to uint64_t
before the multiplication forces extension. To ensure that a
negative integer is not being cast to uint64_t, add a check in
the if-statement.

Fixes: 7a1f9c782b50 ("net/bnxt: add multi-doorbell support")
Cc: stable@dpdk.org
Signed-off-by: Zoe Cheimets <zoe.cheimets@broadcom.com>
Signed-off-by: Mohammad Shuab Siddique <mohammad-shuab.siddique@broadcom.com>
---
 drivers/net/bnxt/bnxt_ring.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index ccca779b97..579b73d2ce 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -385,9 +385,10 @@ void bnxt_set_db(struct bnxt *bp,
 		db->doorbell = (char *)bp->doorbell_base + db_offset;
 
 		if (bp->fw_cap & BNXT_FW_CAP_MULTI_DB &&
-				dpi != BNXT_PRIVILEGED_DPI) {
-			dpi_offset = (dpi - bp->nq_dpi_start) *
-					bp->db_page_size;
+		    dpi != BNXT_PRIVILEGED_DPI &&
+		    dpi >= bp->nq_dpi_start) {
+			dpi_offset = (uint64_t)(dpi - bp->nq_dpi_start) *
+							bp->db_page_size;
 			db->doorbell = (char *)db->doorbell + dpi_offset;
 		}
 		db->db_key64 |= (uint64_t)fid << DBR_XID_SFT;
-- 
2.47.3


  parent reply	other threads:[~2026-06-03 17:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 17:51 [PATCH 0/4] net/bnxt: miscellaneous bug fixes Mohammad Shuab Siddique
2026-06-03 17:51 ` [PATCH 1/4] net/bnxt: modify check for short Tx BDs Mohammad Shuab Siddique
2026-06-04 17:36   ` Kishore Padmanabha
2026-06-03 17:51 ` [PATCH 2/4] net/bnxt: fix QP resource count in backing store config Mohammad Shuab Siddique
2026-06-04 17:41   ` Kishore Padmanabha
2026-06-03 17:51 ` Mohammad Shuab Siddique [this message]
2026-06-04 17:41   ` [PATCH 3/4] net/bnxt: remove implicit integer sign-extension Kishore Padmanabha
2026-06-03 17:51 ` [PATCH 4/4] net/bnxt: fix RSS hash mode configuration for VFs Mohammad Shuab Siddique
2026-06-04 17:42   ` Kishore Padmanabha
2026-06-03 18:36 ` [PATCH v2] " Mohammad Shuab Siddique
2026-06-03 20:02 ` [PATCH v3 4/4] " Mohammad Shuab Siddique
2026-06-03 21:44   ` Stephen Hemminger
2026-06-04 22:56 ` [PATCH v2 0/4] net/bnxt: miscellaneous bug fixes Mohammad Shuab Siddique
2026-06-04 22:56   ` [PATCH v2 1/4] net/bnxt: modify check for short Tx BDs Mohammad Shuab Siddique
2026-06-04 22:56   ` [PATCH v2 2/4] net/bnxt: fix QP resource count in backing store config Mohammad Shuab Siddique
2026-06-04 22:56   ` [PATCH v2 3/4] net/bnxt: remove implicit integer sign-extension Mohammad Shuab Siddique
2026-06-04 22:56   ` [PATCH v2 4/4] net/bnxt: fix RSS hash mode configuration for VFs Mohammad Shuab Siddique
2026-06-10 18:17   ` [PATCH v2 0/4] net/bnxt: miscellaneous bug fixes 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=20260603175137.1990204-4-Mohammad-Shuab.Siddique@broadcom.com \
    --to=mohammad-shuab.siddique@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.com \
    --cc=stable@dpdk.org \
    --cc=zoe.cheimets@broadcom.com \
    /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