mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: kbuild@01.org, Ingo Molnar <mingo@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sched: Fix rt/dl hotplug condition
Date: Wed, 12 Feb 2014 10:49:30 +0100	[thread overview]
Message-ID: <20140212094930.GB3545@laptop.programming.kicks-ass.net> (raw)
In-Reply-To: <20140212090222.GK26776@mwanda>

Dan Carpenter reported:

> kernel/sched/rt.c:1347 pick_next_task_rt() warn: variable dereferenced before check 'prev' (see line 1338)
> kernel/sched/deadline.c:1011 pick_next_task_dl() warn: variable dereferenced before check 'prev' (see line 1005)

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Juri Lelli <juri.lelli@gmail.com>
Fixes: 38033c37faab ("sched: Push down pre_schedule() and idle_balance()")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
---
 kernel/sched/deadline.c | 2 +-
 kernel/sched/rt.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index ed31ef66ab9d..d60008e4bce9 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1001,7 +1001,7 @@ struct task_struct *pick_next_task_dl(struct rq *rq, struct task_struct *prev)
 	dl_rq = &rq->dl;
 
 #ifdef CONFIG_SMP
-	if (dl_task(prev))
+	if (prev && dl_task(prev))
 		pull_dl_task(rq);
 #endif
 
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 72f9ec759972..7294b498b2c1 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1334,7 +1334,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
 
 #ifdef CONFIG_SMP
 	/* Try to pull RT tasks here if we lower this rq's prio */
-	if (rq->rt.highest_prio.curr > prev->prio)
+	if (prev && (rq->rt.highest_prio.curr > prev->prio))
 		pull_rt_task(rq);
 #endif
 

       reply	other threads:[~2014-02-12  9:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140212090222.GK26776@mwanda>
2014-02-12  9:49 ` Peter Zijlstra [this message]
2014-02-21 21:30   ` [tip:sched/core] sched: Fix hotplug task migration tip-bot for Peter Zijlstra

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=20140212094930.GB3545@laptop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kbuild@01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.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

Powered by JetHome