From 6e92713cbafca57d48efdf2108fedb68addbb00b Mon Sep 17 00:00:00 2001 From: Puja Gupta Date: Thu, 16 Nov 2017 13:39:33 -0800 Subject: [PATCH] sched: Fix possible overflow in cpu_cycles_to_freq() Truncating period to u32 could lead to incorrect results. Make it u64 instead. Change-Id: I5224a943e64bc6d64b6c8e614a01f798a6cdc796 Signed-off-by: Puja Gupta Signed-off-by: Pavankumar Kondeti --- kernel/sched/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 7426ae4dced3..c0e3314bf4c2 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1249,7 +1249,7 @@ static inline int cpu_min_power_cost(int cpu) return cpu_rq(cpu)->cluster->min_power_cost; } -static inline u32 cpu_cycles_to_freq(u64 cycles, u32 period) +static inline u32 cpu_cycles_to_freq(u64 cycles, u64 period) { return div64_u64(cycles, period); }