From: riegamaths@gmail.com
To: qemu-trivial <qemu-trivial@nongnu.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel <qemu-devel@nongnu.org>,
Dunrong Huang <riegamaths@gmail.com>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Subject: [Qemu-devel] [RESEND PATCH] vl.c: Exit QEMU early if no machine is found
Date: Thu, 9 Aug 2012 14:57:51 +0800 [thread overview]
Message-ID: <1344495471-3957-1-git-send-email-riegamaths@gmail.com> (raw)
From: Dunrong Huang <riegamaths@gmail.com>
We check whether the variable machine is NULL or not before accessing
it. If machine is NULL, exit QEMU with an error, this can avoids a
segfault error.
Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
---
vl.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/vl.c b/vl.c
index e71cb30..1596617 100644
--- a/vl.c
+++ b/vl.c
@@ -3204,6 +3204,11 @@ int main(int argc, char **argv, char **envp)
}
loc_set_none();
+ if (machine == NULL) {
+ fprintf(stderr, "No machine found.\n");
+ exit(1);
+ }
+
if (machine->hw_version) {
qemu_set_version(machine->hw_version);
}
@@ -3246,11 +3251,6 @@ int main(int argc, char **argv, char **envp)
data_dir = CONFIG_QEMU_DATADIR;
}
- if (machine == NULL) {
- fprintf(stderr, "No machine found.\n");
- exit(1);
- }
-
/*
* Default to max_cpus = smp_cpus, in case the user doesn't
* specify a max_cpus value.
--
1.7.8.6
next reply other threads:[~2012-08-09 6:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-09 6:57 riegamaths [this message]
2012-08-09 9:19 ` [Qemu-devel] [Qemu-trivial] [RESEND PATCH] vl.c: Exit QEMU early if no machine is found Stefan Hajnoczi
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=1344495471-3957-1-git-send-email-riegamaths@gmail.com \
--to=riegamaths@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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).