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

Commit 75f71c68 authored by Joonwoo Park's avatar Joonwoo Park Committed by Satya Durga Srinivasu Prabhala
Browse files

sched: ceil idle index to prevent from out of bound accessing



It's possible size of given idle cost index is smaller than CPU's
possible idle index size.  Ceil the CPU's idle index to prevent out
of bound accessing.

Change-Id: I0ff90d1552daba7824a5d8a9e50ff8463de0d861
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
[satyap@codeaurora.org: trivial merge conflict resolution.]
Signed-off-by: default avatarSatya Durga Srinivasu Prabhala <satyap@codeaurora.org>
parent c87bf20f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5917,6 +5917,9 @@ static int calc_sg_energy(struct energy_env *eenv)
		if (unlikely(idle_idx < 0))
			return idle_idx;

		if (idle_idx > sg->sge->nr_idle_states - 1)
			idle_idx = sg->sge->nr_idle_states - 1;

		idle_power = sg->sge->idle_states[idle_idx].power;
		idle_energy   = SCHED_CAPACITY_SCALE - sg_util;
		idle_energy  *= idle_power;