Skip to content

Commit 0bb040a

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
sched: Fix up attr::sched_priority warning
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: d50dde5 ("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>
1 parent 39fd8fd commit 0bb040a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/sched/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,8 +3282,7 @@ static int __sched_setscheduler(struct task_struct *p,
32823282
* 1..MAX_USER_RT_PRIO-1, valid priority for SCHED_NORMAL,
32833283
* SCHED_BATCH and SCHED_IDLE is 0.
32843284
*/
3285-
if (attr->sched_priority < 0 ||
3286-
(p->mm && attr->sched_priority > MAX_USER_RT_PRIO-1) ||
3285+
if ((p->mm && attr->sched_priority > MAX_USER_RT_PRIO-1) ||
32873286
(!p->mm && attr->sched_priority > MAX_RT_PRIO-1))
32883287
return -EINVAL;
32893288
if ((dl_policy(policy) && !__checkparam_dl(attr)) ||

0 commit comments

Comments
 (0)