aboutsummaryrefslogtreecommitdiffstats
path: root/lib/string_helpers.c
diff options
context:
space:
mode:
authorSalman Qazi <[email protected]>2012-03-10 00:41:01 +0000
committerIngo Molnar <[email protected]>2012-03-13 15:27:51 +0000
commit9993bc635d01a6ee7f6b833b4ee65ce7c06350b1 (patch)
tree9e40c69ef513fc0a57c03a05a68afc6711418ed8 /lib/string_helpers.c
parentMerge tag 'v3.3-rc7' into sched/core (diff)
downloadkernel-9993bc635d01a6ee7f6b833b4ee65ce7c06350b1.tar.gz
kernel-9993bc635d01a6ee7f6b833b4ee65ce7c06350b1.zip
sched/x86: Fix overflow in cyc2ns_offset
When a machine boots up, the TSC generally gets reset. However, when kexec is used to boot into a kernel, the TSC value would be carried over from the previous kernel. The computation of cycns_offset in set_cyc2ns_scale is prone to an overflow, if the machine has been up more than 208 days prior to the kexec. The overflow happens when we multiply *scale, even though there is enough room to store the final answer. We fix this issue by decomposing tsc_now into the quotient and remainder of division by CYC2NS_SCALE_FACTOR and then performing the multiplication separately on the two components. Refactor code to share the calculation with the previous fix in __cycles_2_ns(). Signed-off-by: Salman Qazi <[email protected]> Acked-by: John Stultz <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Cc: Paul Turner <[email protected]> Cc: john stultz <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'lib/string_helpers.c')
0 files changed, 0 insertions, 0 deletions