Skip to content

Commit 0ea6c8f

Browse files
Joonwoo ParkExactExampl
authored andcommitted
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: Idecb4f68758dd0183886ea74d0e9da3d236b0062 Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org> Signed-off-by: Lingutla Chandrasekhar <clingutla@codeaurora.org> (cherry picked from commit ecedc7afd841c8d7ef0145924620304608d269ef)
1 parent 23c953f commit 0ea6c8f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

kernel/sched/fair.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5892,6 +5892,9 @@ static int calc_sg_energy(struct energy_env *eenv)
58925892
idle_idx = group_idle_state(eenv, cpu_idx);
58935893
if (unlikely(idle_idx < 0))
58945894
return idle_idx;
5895+
if (idle_idx > sg->sge->nr_idle_states - 1)
5896+
idle_idx = sg->sge->nr_idle_states - 1;
5897+
58955898
idle_power = sg->sge->idle_states[idle_idx].power;
58965899

58975900
idle_energy = SCHED_CAPACITY_SCALE - sg_util;

0 commit comments

Comments
 (0)