Skip to contentSkip to conversation

sched: Fix sd->*_idx limit range avoiding overflow

PATCH RESEND New libin 2 participants 2 messages Apr 8, 2013 Scheduler

lore
Share & tools
lore

libin

author
#0 lore raw

PATCH RESEND 1/1 sched: Fix sd->*_idx limit range avoiding overflow

Commit 201c373e8e ("sched/debug: Limit sd->*_idx range on sysctl") was an incomplete bug fix. This patch fixs sd->*_idx limit range to [0 ~ CPU_LOAD_IDX_MAX - 1] avioding array overflow caused by setting sd->*_idx to CPU_LOAD_IDX_MAX on sysctl.

---
 kernel/sched/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/sched/core.c +1 -1
index 7f12624..ba89ada 100644
@@ -4999,7 +4999,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,

-- 1.6.0.2

#1 lore raw

[tip:sched/urgent] sched/debug: Fix sd-> *_idx limit range avoiding overflow

sched/debug: Fix sd->*_idx limit range avoiding overflow
Commit-ID:  fd9b86d37a600488dbd80fe60cca46b822bff1cd
Gitweb:     http://git.kernel.org/tip/fd9b86d37a600488dbd80fe60cca46b822bff1cd
Author:     libin <[email protected]>
AuthorDate: Mon, 8 Apr 2013 14:39:12 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 8 Apr 2013 13:23:03 +0200

sched/debug: Fix sd->*_idx limit range avoiding overflow

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.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 306943f..fa07792 100644
@@ -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,