Commit fa93384f authored by Dan Carpenter's avatar Dan Carpenter Committed by Ingo Molnar

sched: Fix signedness bug in yield_to()

yield_to() is supposed to return -ESRCH if there is no task to
yield to, but because the type is bool that is the same as returning
true.

The only place I see which cares is kvm_vcpu_on_spin().
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarRaghavendra <raghavendra.kt@linux.vnet.ibm.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Link: http://lkml.kernel.org/r/20140523102042.GA7267@mwandaSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 2538d960
...@@ -584,7 +584,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn); ...@@ -584,7 +584,7 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
void kvm_vcpu_block(struct kvm_vcpu *vcpu); void kvm_vcpu_block(struct kvm_vcpu *vcpu);
void kvm_vcpu_kick(struct kvm_vcpu *vcpu); void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
bool kvm_vcpu_yield_to(struct kvm_vcpu *target); int kvm_vcpu_yield_to(struct kvm_vcpu *target);
void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu); void kvm_vcpu_on_spin(struct kvm_vcpu *vcpu);
void kvm_load_guest_fpu(struct kvm_vcpu *vcpu); void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
void kvm_put_guest_fpu(struct kvm_vcpu *vcpu); void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
......
...@@ -2180,7 +2180,7 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { } ...@@ -2180,7 +2180,7 @@ static inline void sched_autogroup_fork(struct signal_struct *sig) { }
static inline void sched_autogroup_exit(struct signal_struct *sig) { } static inline void sched_autogroup_exit(struct signal_struct *sig) { }
#endif #endif
extern bool yield_to(struct task_struct *p, bool preempt); extern int yield_to(struct task_struct *p, bool preempt);
extern void set_user_nice(struct task_struct *p, long nice); extern void set_user_nice(struct task_struct *p, long nice);
extern int task_prio(const struct task_struct *p); extern int task_prio(const struct task_struct *p);
/** /**
......
...@@ -4195,7 +4195,7 @@ EXPORT_SYMBOL(yield); ...@@ -4195,7 +4195,7 @@ EXPORT_SYMBOL(yield);
* false (0) if we failed to boost the target. * false (0) if we failed to boost the target.
* -ESRCH if there's no task to yield to. * -ESRCH if there's no task to yield to.
*/ */
bool __sched yield_to(struct task_struct *p, bool preempt) int __sched yield_to(struct task_struct *p, bool preempt)
{ {
struct task_struct *curr = current; struct task_struct *curr = current;
struct rq *rq, *p_rq; struct rq *rq, *p_rq;
......
...@@ -1708,11 +1708,11 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu) ...@@ -1708,11 +1708,11 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
EXPORT_SYMBOL_GPL(kvm_vcpu_kick); EXPORT_SYMBOL_GPL(kvm_vcpu_kick);
#endif /* !CONFIG_S390 */ #endif /* !CONFIG_S390 */
bool kvm_vcpu_yield_to(struct kvm_vcpu *target) int kvm_vcpu_yield_to(struct kvm_vcpu *target)
{ {
struct pid *pid; struct pid *pid;
struct task_struct *task = NULL; struct task_struct *task = NULL;
bool ret = false; int ret = 0;
rcu_read_lock(); rcu_read_lock();
pid = rcu_dereference(target->pid); pid = rcu_dereference(target->pid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment