From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, aliguori@us.ibm.com, av1474@comtv.ru,
dingel@linux.vnet.ibm.com, borntraeger@de.ibm.com
Subject: [Qemu-devel] [PATCH] QOM: Fail casts for unknown types
Date: Tue, 30 Apr 2013 15:02:16 +0200 [thread overview]
Message-ID: <1367326936-28539-1-git-send-email-agraf@suse.de> (raw)
When we try to cast an object to an unknown type, fail the cast. Today
we would simply run into an assert().
This fixes a bug on qemu-system-s390x for me that gets triggered by the
audio code looking for PCI and ISA buses.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
qom/object.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index dd53d24..75e6aac 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -453,6 +453,11 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
TypeImpl *type = class->type;
ObjectClass *ret = NULL;
+ if (!target_type) {
+ /* target class type unknown, so fail the cast */
+ return NULL;
+ }
+
if (type->class->interfaces &&
type_is_ancestor(target_type, type_interface)) {
int found = 0;
--
1.6.0.2
next reply other threads:[~2013-04-30 13:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 13:02 Alexander Graf [this message]
2013-04-30 13:57 ` [Qemu-devel] [PATCH] QOM: Fail casts for unknown types Paolo Bonzini
2013-04-30 14:58 ` Andreas Färber
2013-04-30 18:58 ` Anthony Liguori
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=1367326936-28539-1-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=av1474@comtv.ru \
--cc=borntraeger@de.ibm.com \
--cc=dingel@linux.vnet.ibm.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).