[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25e057c00909291115t63c36ddm657f9359d1ae34f4@mail.gmail.com>
Date: Tue, 29 Sep 2009 20:15:37 +0200
From: roel kluin <roel.kluin@...il.com>
To: Raistlin <raistlin@...ux.it>
Cc: Linus Walleij <linus.ml.walleij@...il.com>,
Peter Zijlstra <peterz@...radead.org>, claudio@...dence.eu.com,
michael@...dence.eu.com, mingo@...e.hu,
linux-kernel@...r.kernel.org, tglx@...utronix.de,
johan.eker@...csson.com, p.faure@...tech.ch,
Fabio Checconi <fabio@...dalf.sssup.it>,
Dhaval Giani <dhaval.giani@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Tommaso Cucinotta <tommaso.cucinotta@...up.it>
Subject: Re: [RFC][PATCH] SCHED_EDF scheduling class
> static int __sched_setscheduler(struct task_struct *p, int policy,
> - struct sched_param *param, bool user)
> + struct sched_param *param,
> + struct sched_param_ex *param_ex,
> + bool user)
...
> @@ -6200,6 +6364,13 @@ recheck:
> (p->mm && param->sched_priority > MAX_USER_RT_PRIO-1) ||
> (!p->mm && param->sched_priority > MAX_RT_PRIO-1))
> return -EINVAL;
> + if (edf_policy(policy) && param_ex->sched_priority != 0)
> + return -EINVAL;
> + if (edf_policy(policy) && (param_ex == NULL ||
> + timespec_to_ns(¶m_ex->sched_period) == 0 ||
> + timespec_to_ns(¶m_ex->sched_period) <
> + timespec_to_ns(¶m_ex->sched_runtime)))
> + return -EINVAL;
shouldn't the NULL test be moved upwards, to prevent a dereference of
a NULL pointer? Also I notice that `timespec_to_ns(¶m_ex->sched_period)'
is called twice, maybe gcc does this but can't we do something like
if (edf_policy(policy)) {
if (param_ex == NULL || param_ex->sched_priority != 0)
return -EINVAL;
s64 psp = timespec_to_ns(¶m_ex->sched_period);
if (psp == 0 || psp < timespec_to_ns(¶m_ex->sched_runtime))
return -EINVAL;
}
Roel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists