From: Wei Yongjun <[email protected]>

The ioctl KVM_IA64_VCPU_GET_STACK does not set the error code if
copy_to_user() fail, and 0 will be return, we should use -EFAULT
instead of 0 in this case, so this patch fixed it.

Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>

diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 26e0e08..bc07c81 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1535,8 +1535,10 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
                        goto out;
 
                if (copy_to_user(user_stack, stack,
-                                sizeof(struct kvm_ia64_vcpu_stack)))
+                                sizeof(struct kvm_ia64_vcpu_stack))) {
+                       r = -EFAULT;
                        goto out;
+               }
 
                break;
        }
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to