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

Commit 2cadd393 authored by Joonwoo Park's avatar Joonwoo Park
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>
parent 4632f561
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5644,6 +5644,9 @@ static int sched_group_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;

				group_util = group_norm_util(eenv, sg);
				sg_busy_energy = (group_util * sg->sge->cap_states[cap_idx].power);