HomeFreeBSD

clockcalib: Fix an overflow bug

Description

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)

Details

Provenance
markjAuthored on Jan 20 2022, 1:23 PM
Parents
rGcd651fcc491c: Update to RC6
Branches
Unknown
Tags
Unknown