From: Sokolov Evgeny <[email protected]> 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 <[email protected]> Cc: [email protected] --- 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

