git: 36465977968f - stable/15 - ixgbe: avoid signed overflow in pause time calculation
Kevin Bowling <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a767a7f.3ed15.67badf4f__46055.0617471867$1786149601$gmane$org@gitrepo.freebsd.org> |
The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=36465977968f8cc5270d25b603e0a03fcae093d2 commit 36465977968f8cc5270d25b603e0a03fcae093d2 Author: Kevin Bowling <[email protected]> AuthorDate: 2026-07-28 11:10:09 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-08-08 00:36:04 +0000 ixgbe: avoid signed overflow in pause time calculation pause_time is promoted to signed int before multiplication. Its default value of 65535 multiplied by 65537 exceeds INT_MAX and triggers UBSAN, even though the result is assigned to a u32. Make the multiplier unsigned so the calculation has the intended u32 semantics. Linux commit 3b70683fc4d6 reported the failure in the generic path and used the same mechanical correction. The 82598-specific flow control operation contains the identical expression, so correct it as well. (cherry picked from commit 35374c3ec69aa87561431e6236706c485bdeeacc) --- sys/dev/ixgbe/ixgbe_82598.c | 2 +- sys/dev/ixgbe/ixgbe_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/ixgbe/ixgbe_82598.c b/sys/dev/ixgbe/ixgbe_82598.c index e32fdb8f039c..f27f263dd07f 100644 --- a/sys/dev/ixgbe/ixgbe_82598.c +++ b/sys/dev/ixgbe/ixgbe_82598.c @@ -535,7 +535,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw) } /* Configure pause time (2 TCs per register) */ - reg = hw->fc.pause_time * 0x00010001; + reg = hw->fc.pause_time * 0x00010001U; for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++) IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg); diff --git a/sys/dev/ixgbe/ixgbe_common.c b/sys/dev/ixgbe/ixgbe_common.c index c836ccebff0c..6495bfdecc60 100644 --- a/sys/dev/ixgbe/ixgbe_common.c +++ b/sys/dev/ixgbe/ixgbe_common.c @@ -2932,7 +2932,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw) } /* Configure pause time (2 TCs per register) */ - reg = hw->fc.pause_time * 0x00010001; + reg = hw->fc.pause_time * 0x00010001U; for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++) IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);