]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
fix integer overflow bugs in *stosbt
authorWarner Losh <imp@FreeBSD.org>
Wed, 6 Apr 2022 03:35:27 +0000 (21:35 -0600)
committerWarner Losh <imp@FreeBSD.org>
Wed, 6 Apr 2022 17:46:08 +0000 (11:46 -0600)
commit11931e7aa83515e5d33f04cf11e8a3913df61d60
tree632ead6b40e00a9aa2f0b2d35436a9c68170ae5e
parentc872d65b55aa3bf6c030276eb0c7933015b20801
fix integer overflow bugs in *stosbt

68f57679d660 Fixed another class of integer overflows, but introduced a
boundary condition for 2-4s in ns conversion, 2-~4000s in us conversions
and 2-~4,000,000s in ms conversions. This was because we bogusly used
SBT_1S for the notion of 1 second, instead of the appropriate power of
10. To fix, just use the appropriate power of 10, which avoids these
overflows.

This caused some sleeps in ZFS to be on the order of an hour.

Approved by: re@ (gjb)
MFC: 1 day
PR: 263073
Sponsored by: Netflix
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D34790

(cherry picked from commit 4c30b9ecd47a2d92565731082a6a4f2bd1e6e051)
(cherry picked from commit c43786cc37641cef02171a3c5be5a588d850e6ab)
sys/sys/time.h