qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Xu He Jie <xuhj@linux.vnet.ibm.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] kvm_init didn't set return value after create vm failed
Date: Wed, 26 Oct 2011 19:09:58 +0800	[thread overview]
Message-ID: <4EA7EA86.1070000@linux.vnet.ibm.com> (raw)
In-Reply-To: <4EA7E913.90100@siemens.com>

于 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<xuhj@linux.vnet.ibm.com>
>> ---
>>   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

      reply	other threads:[~2011-10-26 13:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-26 10:19 [Qemu-devel] [PATCH] kvm_init didn't set return value after create vm failed Xu He Jie
2011-10-26 11:03 ` Jan Kiszka
2011-10-26 11:09   ` Xu He Jie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA7EA86.1070000@linux.vnet.ibm.com \
    --to=xuhj@linux.vnet.ibm.com \
    --cc=jan.kiszka@siemens.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).