]> 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 16:08:54 +0000 (12:08 -0400)
commit58f49b7da7da50d1ea66b5d810a5e8769b5319f4
treed7504094032e627f287501f2fb3bc3d70d36d8c3
parent249d205cb8d9eacee936fa15fadb034c8ea0f4ea
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

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