[PATCH 3/4] net/bnxt: remove implicit integer sign-extension

Kishore Padmanabha kishore.padmanabha at broadcom.com
Thu Jun 4 19:41:49 CEST 2026


On Wed, Jun 3, 2026 at 1:50 PM Mohammad Shuab Siddique <
mohammad-shuab.siddique at broadcom.com> wrote:

> From: Zoe Cheimets <zoe.cheimets at 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 at dpdk.org
> Signed-off-by: Zoe Cheimets <zoe.cheimets at broadcom.com>
> Signed-off-by: Mohammad Shuab Siddique <
> mohammad-shuab.siddique at broadcom.com>
>
Acked-by:  Kishore Padmanabha <kishore.padmanabha at 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20260604/f6f71526/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5493 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mails.dpdk.org/archives/dev/attachments/20260604/f6f71526/attachment.bin>


More information about the dev mailing list