From: Paolo Bonzini <pbonzini@redhat.com>
To: Alexander Graf <agraf@suse.de>
Cc: borntraeger@de.ibm.com, aliguori@us.ibm.com, av1474@comtv.ru,
qemu-devel@nongnu.org, dingel@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] QOM: Fail casts for unknown types
Date: Tue, 30 Apr 2013 15:57:20 +0200 [thread overview]
Message-ID: <517FCDC0.4090000@redhat.com> (raw)
In-Reply-To: <1367326936-28539-1-git-send-email-agraf@suse.de>
Il 30/04/2013 15:02, Alexander Graf ha scritto:
> 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>
Seems a better solution than guarding the object_resolve_path_type with
an if.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Paolo
> ---
> 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;
>
next prev parent reply other threads:[~2013-04-30 13:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-30 13:02 [Qemu-devel] [PATCH] QOM: Fail casts for unknown types Alexander Graf
2013-04-30 13:57 ` Paolo Bonzini [this message]
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=517FCDC0.4090000@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=av1474@comtv.ru \
--cc=borntraeger@de.ibm.com \
--cc=dingel@linux.vnet.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.