]> 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, 20 Jan 2022 13:23:38 +0000 (08:23 -0500)
commitc3196306f092e46008d5ffa626fbafe1f8a94848
tree005e2a8b1657c6242225dea2d55c58a7b98c2d0b
parente0282802a6eca08598c511d9d81aa407bd273cbe
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.

Fixes: c2705ceaeb09 ("x86: Speed up clock calibration")
Reviewed by: cperciva
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33956
sys/kern/subr_clockcalib.c