sched: Fix sched_policy < 0 comparison

attr.sched_policy is u32, therefore a comparison against < 0 is never true.
Fix this by casting sched_policy to int.

This issue was reported by coverity CID 1219934.

Fixes: dbdb22754f ("sched: Disallow sched_attr::sched_policy < 0")
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: http://lkml.kernel.org/r/1401741514-7045-1-git-send-email-richard@nod.at
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Richard Weinberger 2014-06-02 22:38:34 +02:00 коммит произвёл Ingo Molnar
Родитель e9dd685ce8
Коммит b14ed2c273
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -3685,7 +3685,7 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
if (retval)
return retval;
if (attr.sched_policy < 0)
if ((int)attr.sched_policy < 0)
return -EINVAL;
rcu_read_lock();