aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/trace-event-scripting.c
diff options
context:
space:
mode:
authorKevin Hilman <[email protected]>2014-01-15 14:51:38 +0100
committerFrederic Weisbecker <[email protected]>2014-01-16 00:08:12 +0100
commit8fe8ff09ce3b5750e1f3e45a1f4a81d59c7ff1f1 (patch)
tree213e7ac5b96c59f82d49ef72285ddceace6d79a9 /tools/perf/util/trace-event-scripting.c
parente9a2eb403bd953788cd2abfd0d2646d43bd22671 (diff)
sched/nohz: Fix overflow error in scheduler_tick_max_deferment()
While calculating the scheduler tick max deferment, the delta is converted from microseconds to nanoseconds through a multiplication against NSEC_PER_USEC. But this microseconds operand is an unsigned int, thus the result may likely overflow. The result is cast to u64 but only once the operation is completed, which is too late to avoid overflown result. This is currently not a problem because the scheduler tick max deferment is 1 second. But this may become an issue as we plan to make this value tunable. So lets fix this by casting the usecs value to u64 before multiplying by NSECS_PER_USEC. Also to prevent from this kind of mistake to happen again, move this ad-hoc jiffies -> nsecs conversion to a new helper. Signed-off-by: Kevin Hilman <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Alex Shi <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Paul E. McKenney <[email protected]> Cc: John Stultz <[email protected]> Cc: Kevin Hilman <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [move ad-hoc conversion to jiffies_to_nsecs helper] Signed-off-by: Frederic Weisbecker <[email protected]>
Diffstat (limited to 'tools/perf/util/trace-event-scripting.c')
0 files changed, 0 insertions, 0 deletions