qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hu Tao <hutao@cn.fujitsu.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] exit qemu when unknown object type is specified by -object
Date: Fri, 11 Apr 2014 11:59:14 +0800	[thread overview]
Message-ID: <1397188754-10741-1-git-send-email-hutao@cn.fujitsu.com> (raw)

...to avoid assertion failure in object_new_with_type(). Can be
reproduced by: qemu -object unknown-object,id=xxx

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 qom/object.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qom/object.c b/qom/object.c
index f4de619..1e7445b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -448,6 +448,11 @@ Object *object_new(const char *typename)
 {
     TypeImpl *ti = type_get_by_name(typename);
 
+    if (!ti) {
+        error_report("unknown object type: %s\n", typename);
+        exit(1);
+    }
+
     return object_new_with_type(ti);
 }
 
-- 
1.8.5.2.229.g4448466

                 reply	other threads:[~2014-04-11  4:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1397188754-10741-1-git-send-email-hutao@cn.fujitsu.com \
    --to=hutao@cn.fujitsu.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).