Skip to content

Commit

Permalink
sched/debug: Fix sd->*_idx limit range avoiding overflow
Browse files Browse the repository at this point in the history
Commit 201c373 ("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>
  • Loading branch information
libin authored and Ingo Molnar committed Apr 8, 2013
1 parent a1cbcaa commit fd9b86d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4933,7 +4933,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,
Expand Down

0 comments on commit fd9b86d

Please sign in to comment.