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.

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

(cherry picked from commit c3196306f092e46008d5ffa626fbafe1f8a94848)

Details

Provenance
markjAuthored on Jan 20 2022, 1:23 PM
Parents
rG249d205cb8d9: subr_unit.c: make userspace tests buildable
Branches
Unknown
Tags
Unknown