Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b012750 authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri
Browse files

sched: window-stats: Fix overflow bug



Multiplication over-flow possibility exists in update_task_ravg() when
updating task's window_start. That would lead to incorrect accounting
of task load. Fix the issue by using 64-bit arithmetic.

CRs-Fixed: 665706
Change-Id: I92651c41efa6121bb8fe102e495ae956127b237a
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@codeaurora.org>
parent 19bd5134
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1457,7 +1457,8 @@ void update_task_ravg(struct task_struct *p, struct rq *rq, int update_sum)
			if (!update_sum)
				p->ravg.window_start = wallclock;
			else
				p->ravg.window_start += n * window_size;
				p->ravg.window_start += (u64)n *
							 (u64)window_size;
			BUG_ON(p->ravg.window_start > wallclock);
			if (update_sum)
				update_history(rq, p, window_size, n);