summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorlibin <huawei.libin@huawei.com>2013-04-08 14:39:12 +0800
committerBen Hutchings <ben@decadent.org.uk>2013-05-30 14:35:09 +0100
commitac93bc6a8ab8b760423ca0c4d42311f0d1f5cfcd (patch)
tree4fae74440193ca1e98a6e9140543e5967d51889c /kernel
parent077c9f651e2d46f374ed2103b95ed492c4f4b52b (diff)
sched/debug: Fix sd->*_idx limit range avoiding overflow
commit fd9b86d37a600488dbd80fe60cca46b822bff1cd upstream. Commit 201c373e8e ("sched/debug: Limit sd->*_idx range on sysctl") was an incomplete bug fix. This patch fixes sd->*_idx limit range to [0 ~ CPU_LOAD_IDX_MAX-1] avoiding array overflow caused by setting sd->*_idx to CPU_LOAD_IDX_MAX on sysctl. Signed-off-by: Libin <huawei.libin@huawei.com> Cc: <jiang.liu@huawei.com> Cc: <guohanjun@huawei.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/51626610.2040607@huawei.com Signed-off-by: Ingo Molnar <mingo@kernel.org> [bwh: Backported to 3.2: adjust filename] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index cfcbe1e9544f..d93369a977d1 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -6673,7 +6673,7 @@ static void sd_free_ctl_entry(struct ctl_table **tablep)
}
static int min_load_idx = 0;
-static int max_load_idx = CPU_LOAD_IDX_MAX;
+static int max_load_idx = CPU_LOAD_IDX_MAX-1;
static void
set_table_entry(struct ctl_table *entry,