From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:35381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ3jv-0006zc-R2 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 09:41:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RJ3jr-000831-Q1 for qemu-devel@nongnu.org; Wed, 26 Oct 2011 09:41:55 -0400 Received: from e28smtp08.in.ibm.com ([122.248.162.8]:55399) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RJ3jr-00082e-7W for qemu-devel@nongnu.org; Wed, 26 Oct 2011 09:41:51 -0400 Received: from /spool/local by e28smtp08.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Oct 2011 16:40:55 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p9QBAq8j2879610 for ; Wed, 26 Oct 2011 16:40:52 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p9QBAqll007670 for ; Wed, 26 Oct 2011 22:10:52 +1100 Message-ID: <4EA7EA86.1070000@linux.vnet.ibm.com> Date: Wed, 26 Oct 2011 19:09:58 +0800 From: Xu He Jie MIME-Version: 1.0 References: <1319624387-15707-1-git-send-email-xuhj@linux.vnet.ibm.com> <4EA7E913.90100@siemens.com> In-Reply-To: <4EA7E913.90100@siemens.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] kvm_init didn't set return value after create vm failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: qemu-devel@nongnu.org 于 2011年10月26日 19:03, Jan Kiszka 写道: > On 2011-10-26 12:19, Xu He Jie wrote: >> kvm_init didn't set return value after create vm failed. >> >> And kvm_ioctl(s, KVM_CREATE_VM, 0)'s return value can be< -1, >> so change the check of vmfd at label 'err'. >> >> Signed-off-by: Xu He Jie >> --- >> kvm-all.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/kvm-all.c b/kvm-all.c >> index e7faf5c..70edb39 100644 >> --- a/kvm-all.c >> +++ b/kvm-all.c >> @@ -739,6 +739,7 @@ int kvm_init(void) >> fprintf(stderr, "Please add the 'switch_amode' kernel parameter to " >> "your host kernel command line\n"); >> #endif >> + ret = -errno; > kvm_ioctl returns -errno while that fprintf may overwrite it. Just set > ret to s->vmfd. ok. > >> goto err; >> } >> >> @@ -797,7 +798,7 @@ int kvm_init(void) >> >> err: >> if (s) { >> - if (s->vmfd != -1) { >> + if (s->vmfd>= 0) { >> close(s->vmfd); >> } >> if (s->fd != -1) { > That looks correct. > > The patch will probably flow via uq/master, so you should address Avi > and Marcelo with v2. > > Thanks, > Jan > Thanks, Xu