From: Chen Liang Date: Mon, 11 Jul 2016 09:41:31 +0000 (+0800) Subject: ARM64: dts: rk3399: prevent out of bounds accesses to array X-Git-Tag: firefly_0821_release~2180 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=commitdiff_plain;h=91b9817e6d74782b7c234a80d5182050b0f05209 ARM64: dts: rk3399: prevent out of bounds accesses to array It will return state++ when get the idle state, so we need fill anothor idle power(=WFI) in the parameter of EAS, code as below: static int group_idle_state(struct sched_group *sg) { int i, state = INT_MAX; /* Find the shallowest idle state in the sched group. */ for_each_cpu(i, sched_group_cpus(sg)) state = min(state, idle_get_state_idx(cpu_rq(i))); /* Take non-cpuidle idling into account (active idle/arch_cpu_idle()) */ state++; return state; } Change-Id: I9293da1379746768823df4e75a7478aa50fc0e87 Signed-off-by: Chen Liang --- diff --git a/arch/arm64/boot/dts/rockchip/rk3399-evb-rev2.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-evb-rev2.dtsi index d58b8406cc7f..0d6bd161635e 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-evb-rev2.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-evb-rev2.dtsi @@ -136,6 +136,7 @@ // 1024 3416 /* 1800MHz */ >; idle-cost-data = < + 15 15 0 >; @@ -152,6 +153,7 @@ 449 263 /* 1512M */ >; idle-cost-data = < + 6 6 0 >; @@ -171,6 +173,7 @@ idle-cost-data = < 65 65 + 65 >; }; @@ -187,6 +190,7 @@ idle-cost-data = < 56 56 + 56 >; }; diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sched-energy.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-sched-energy.dtsi index 5b09347a32f5..5359294d7c08 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-sched-energy.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3399-sched-energy.dtsi @@ -1,9 +1,11 @@ /* static struct idle_state idle_states_cluster_a53[] = { */ +/* { .power = 56 }, /\* arch_cpu_idle() (active idle) = WFI *\/ */ /* { .power = 56 }, /\* WFI *\/ */ /* { .power = 56 }, /\* cpu-sleep-0 *\/ */ /* }; */ /* static struct idle_state idle_states_cluster_a72[] = { */ +/* { .power = 65 }, /\* arch_cpu_idle() (active idle) = WFI *\/ */ /* { .power = 65 }, /\* WFI *\/ */ /* { .power = 65 }, /\* cpu-sleep-0 *\/ */ /* }; */ @@ -45,11 +47,13 @@ /* }; */ /* static struct idle_state idle_states_core_a53[] = { */ +/* { .power = 6 }, /\* arch_cpu_idle() (active idle) = WFI *\/ */ /* { .power = 6 }, /\* WFI *\/ */ /* { .power = 0 }, /\* cpu-sleep-0 *\/ */ /* }; */ /* static struct idle_state idle_states_core_a72[] = { */ +/* { .power = 15 }, /\* arch_cpu_idle() (active idle) = WFI *\/ */ /* { .power = 15 }, /\* WFI *\/ */ /* { .power = 0 }, /\* cpu-sleep-0 *\/ */ /* }; */ @@ -89,6 +93,7 @@ energy-costs { // 1024 3416 /* 1800MHz */ >; idle-cost-data = < + 15 15 0 >; @@ -104,6 +109,7 @@ energy-costs { // 449 263 /* 1512M */ >; idle-cost-data = < + 6 6 0 >; @@ -122,6 +128,7 @@ energy-costs { idle-cost-data = < 65 65 + 65 >; }; CLUSTER_COST_A53: cluster-cost1 { @@ -137,6 +144,7 @@ energy-costs { idle-cost-data = < 56 56 + 56 >; }; };