[PATCH] net/bnxt/tf_ulp: use 64-bit shift in burst size calculation
Kishore Padmanabha
kishore.padmanabha at broadcom.com
Mon Sep 21 21:41:44 CEST 2026
On Tue, Sep 15, 2026 at 5:11 AM Evgeny Sokolov <Evgeny.Sokolov at infotecs.ru>
wrote:
> From: Sokolov Evgeny <Evgeny.Sokolov at infotecs.ru>
>
> Use 1ULL instead of 1 in the left shift operation when
> calculating the burst size mantissa.
>
> This avoids undefined behavior when the shift count exceeds
> the width of a 32-bit integer.
>
> Signed-off-by: Sokolov Evgeny <Evgeny.Sokolov at infotecs.ru>
> Cc: stable at dpdk.org
> ---
> drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
> b/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
> index 7f6a84e699..88a2f30521 100644
> --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
> +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_meter.c
> @@ -155,7 +155,7 @@ bnxt_ulp_flow_mtr_xbs_calc(int64_t xbs, uint16_t *reg)
> * = round(xbs*2^(8-e) - 2^7)
> *
> */
> - m = xbs / (1 << (e - 8)) - (1 << 7);
> + m = xbs / (1ULL << (e - 8)) - (1ULL << 7);
> *reg = ((m & 0x7F) << 5) | (e & 0x1F);
> *reg = rte_cpu_to_be_16(*reg);
> }
> --
Acked-by: Kishore Padmanabha <kishore.padmanabha at broadcom.com>
>
> 2.30.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/stable/attachments/20260921/b02819ec/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/stable/attachments/20260921/b02819ec/attachment.bin>
More information about the stable
mailing list