The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: libin <huawei.libin@huawei.com>
To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <jiang.liu@huawei.com>,
	<guohanjun@huawei.com>
Subject: [PATCH resend] sched: Fix sd->*_idx limit range avoiding overflow
Date: Mon, 8 Apr 2013 14:39:12 +0800	[thread overview]
Message-ID: <51626610.2040607@huawei.com> (raw)

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.

Signed-off-by: Libin <huawei.libin@huawei.com>
---
 kernel/sched/core.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7f12624..ba89ada 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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


             reply	other threads:[~2013-04-08  6:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08  6:39 libin [this message]
2013-04-08 15:28 ` [tip:sched/urgent] sched/debug: Fix sd-> *_idx limit range avoiding overflow tip-bot for libin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51626610.2040607@huawei.com \
    --to=huawei.libin@huawei.com \
    --cc=guohanjun@huawei.com \
    --cc=jiang.liu@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox