diff options
author | Richard Weinberger <richard@nod.at> | 2014-06-02 16:38:34 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-06-05 05:07:43 -0400 |
commit | b14ed2c273f8ab872ae4e6735fe5ab09cb14b8c3 (patch) | |
tree | f7575256a33d949f4ce3919fcd9e8b1f471133b9 /kernel | |
parent | e9dd685ce81815811fb4da72e6ab10a694ac8468 (diff) |
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: dbdb22754fde ("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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 86f3890c3d08..540542b93f9f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3685,7 +3685,7 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr, | |||
3685 | if (retval) | 3685 | if (retval) |
3686 | return retval; | 3686 | return retval; |
3687 | 3687 | ||
3688 | if (attr.sched_policy < 0) | 3688 | if ((int)attr.sched_policy < 0) |
3689 | return -EINVAL; | 3689 | return -EINVAL; |
3690 | 3690 | ||
3691 | rcu_read_lock(); | 3691 | rcu_read_lock(); |