Skip to contentSkip to conversation

KVM: ia64: fix the error code of ioctl KVM_IA64_VCPU_GET_STACK failure

PATCH New Wei Yongjun 1 participant 1 message Mar 12, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: ia64: fix the error code of ioctl KVM_IA64_VCPU_GET_STACK failure

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.

---
 arch/ia64/kvm/kvm-ia64.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
arch/ia64/kvm/kvm-ia64.c +3 -1
index 26e0e08..bc07c81 100644
@@ -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;
 	}
Signature · 1 line
1.6.3.3