]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
clockcalib: Fix an overflow bug
authorMark Johnston <markj@FreeBSD.org>
Thu, 20 Jan 2022 13:23:38 +0000 (08:23 -0500)
committerMark Johnston <markj@FreeBSD.org>
Thu, 5 May 2022 18:37:48 +0000 (14:37 -0400)
commit9470a2f7da488f3c14051e39691fbfddcf2aa0fe
tree91bbdfa99b6d596a8a65ad7d4221f0cc9e0adbc2
parentcd651fcc491c509e2f7d516c56410d3fdfb2be58
clockcalib: Fix an overflow bug

tc_counter_mask is an unsigned int and in the TSC timecounter is equal
to UINT_MAX, so the addition tc->tc_counter_mask + 1 can overflow to 0,
resulting in a hang during boot.

Approved by: re (gjb)
Fixes: c2705ceaeb09 ("x86: Speed up clock calibration")
Reviewed by: cperciva
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c3196306f092e46008d5ffa626fbafe1f8a94848)
(cherry picked from commit 58f49b7da7da50d1ea66b5d810a5e8769b5319f4)
sys/kern/subr_clockcalib.c