sched: Fix up attr::sched_priority warning
authorPeter Zijlstra <peterz@infradead.org>
Wed, 15 Jan 2014 16:15:13 +0000 (17:15 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 16 Jan 2014 08:27:16 +0000 (09:27 +0100)
Fengguang Wu reported the following build warning:

  > kernel/sched/core.c:3067 __sched_setscheduler() warn: unsigned 'attr->sched_priority' is never less than zero.

Since it doesn't make sense for attr::sched_priority to be negative,
remove the check, since we already test for an upper limit any actual
negative values passed in through the old param::sched_priority field
will still be detected.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@gmail.com>
Cc: Dario Faggioli <raistlin@linux.it>
Fixes: d50dde5a10f3 ("sched: Add new scheduler syscalls to support an extended scheduling parameters ABI")
Link: http://lkml.kernel.org/n/tip-fid9nalzii2r5voxtf4eh5kz@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/core.c

index e9212eb..5a6ccdf 100644 (file)
@@ -3282,8 +3282,7 @@ recheck:
         * 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL,
         * SCHED_BATCH and SCHED_IDLE is 0.
         */
-       if (attr->sched_priority < 0 ||
-           (p->mm && attr->sched_priority > MAX_USER_RT_PRIO-1) ||
+       if ((p->mm && attr->sched_priority > MAX_USER_RT_PRIO-1) ||
            (!p->mm && attr->sched_priority > MAX_RT_PRIO-1))
                return -EINVAL;
        if ((dl_policy(policy) && !__checkparam_dl(attr)) ||