From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guo Chao Subject: [PATCH 2/3] KVM: X86: fix return value of kvm_vm_ioctl_set_tss_addr() Date: Fri, 2 Nov 2012 18:33:22 +0800 Message-ID: <1351852403-5947-2-git-send-email-yan@linux.vnet.ibm.com> References: <1351852403-5947-1-git-send-email-yan@linux.vnet.ibm.com> Cc: kvm@vger.kernel.org To: avi@redhat.com, mtosatti@redhat.com Return-path: Received: from e23smtp04.au.ibm.com ([202.81.31.146]:42079 "EHLO e23smtp04.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760237Ab2KBKdd (ORCPT ); Fri, 2 Nov 2012 06:33:33 -0400 Received: from /spool/local by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Nov 2012 20:29:00 +1000 Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qA2AXRmr000438 for ; Fri, 2 Nov 2012 21:33:28 +1100 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qA2AXRtL002502 for ; Fri, 2 Nov 2012 21:33:27 +1100 In-Reply-To: <1351852403-5947-1-git-send-email-yan@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: Return value of this function will be that of ioctl(). #include #include int main () { int fd; fd = open ("/dev/kvm", 0); fd = ioctl (fd, KVM_CREATE_VM, 0); ioctl (fd, KVM_SET_TSS_ADDR, 0xfffff000); perror (""); return 0; } Output is "Operation not permitted". That's not what we want. Return -EINVAL in this case. Signed-off-by: Guo Chao --- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index b3151ec..d9d5b5d 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2944,7 +2944,7 @@ static int kvm_vm_ioctl_set_tss_addr(struct kvm *kvm, unsigned long addr) int ret; if (addr > (unsigned int)(-3 * PAGE_SIZE)) - return -1; + return -EINVAL; ret = kvm_x86_ops->set_tss_addr(kvm, addr); return ret; } -- 1.7.9.5