* [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found
@ 2011-11-10 15:35 Andreas Färber
2011-11-11 19:45 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Färber @ 2011-11-10 15:35 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Andreas Färber
machine defaults to find_default_machine(),
then gets overridden via -M and machine_parse().
If no -M is specified and find_default_machine() returns NULL
(when no machine compiled in), exit with an error.
Avoids a segfault when setting machine->max_cpus.
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
vl.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/vl.c b/vl.c
index f169aac..16fa222 100644
--- a/vl.c
+++ b/vl.c
@@ -3089,6 +3089,11 @@ 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.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found
2011-11-10 15:35 [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found Andreas Färber
@ 2011-11-11 19:45 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2011-11-11 19:45 UTC (permalink / raw)
To: Andreas Färber; +Cc: qemu-trivial, qemu-devel
On 11/10/2011 09:35 AM, Andreas Färber wrote:
> machine defaults to find_default_machine(),
> then gets overridden via -M and machine_parse().
>
> If no -M is specified and find_default_machine() returns NULL
> (when no machine compiled in), exit with an error.
>
> Avoids a segfault when setting machine->max_cpus.
>
> Signed-off-by: Andreas Färber<andreas.faerber@web.de>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> vl.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/vl.c b/vl.c
> index f169aac..16fa222 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3089,6 +3089,11 @@ 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-11 19:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-10 15:35 [Qemu-devel] [PATCH] vl.c: Fail gracefully if no machine is found Andreas Färber
2011-11-11 19:45 ` Anthony Liguori
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).