From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, imammedo@redhat.com, pbonzini@redhat.com
Subject: [PATCH] vl.c/memdev: Error on bad memory backend
Date: Tue, 17 Mar 2020 12:07:59 +0000 [thread overview]
Message-ID: <20200317120759.49367-1-dgilbert@redhat.com> (raw)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
If memory-backend is a non-existent object, qemu crashes.
Check that the backend actually resolves.
e.g. ./qemu-system-x86_64 -machine pc,accel=kvm,memory-backend=foo
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
softmmu/vl.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index ff2685dff8..76507e99c4 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -4288,6 +4288,11 @@ void qemu_init(int argc, char **argv, char **envp)
backend = object_resolve_path_type(current_machine->ram_memdev_id,
TYPE_MEMORY_BACKEND, NULL);
+ if (!backend) {
+ error_report("Unknown memory backend object id '%s'",
+ current_machine->ram_memdev_id);
+ exit(EXIT_FAILURE);
+ }
backend_size = object_property_get_uint(backend, "size", &error_abort);
if (have_custom_ram_size && backend_size != ram_size) {
error_report("Size specified by -m option must match size of "
--
2.24.1
next reply other threads:[~2020-03-17 12:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-17 12:07 Dr. David Alan Gilbert (git) [this message]
2020-03-17 12:34 ` [PATCH] vl.c/memdev: Error on bad memory backend Igor Mammedov
2020-03-17 12:55 ` Dr. David Alan Gilbert
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=20200317120759.49367-1-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.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).