qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] kvm_init didn't set return value after create v


From: Xu He Jie
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1

于 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<address@hidden>
---
  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 via email to

[Prev in Thread] Current Thread [Next in Thread]