[PATCH] net/bnxt/tf_ulp: use 64-bit shift in burst size calculation
Evgeny Sokolov
Evgeny.Sokolov at infotecs.ru
Tue Sep 15 11:11:50 CEST 2026
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);
}
--
2.30.2
More information about the stable
mailing list