From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yongjun Subject: [PATCH] KVM: ia64: fix the error code of ioctl KVM_IA64_VCPU_GET_STACK failure Date: Fri, 12 Mar 2010 08:45:39 +0800 Message-ID: <4B998EB3.1060608@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org, Avi Kivity Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:51564 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752324Ab0CLAnx (ORCPT ); Thu, 11 Mar 2010 19:43:53 -0500 Sender: kvm-owner@vger.kernel.org List-ID: 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 --- arch/ia64/kvm/kvm-ia64.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) 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; } -- 1.6.3.3