qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] QOM: Fail casts for unknown types


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] QOM: Fail casts for unknown types
Date: Tue, 30 Apr 2013 15:57:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

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 <address@hidden>

Seems a better solution than guarding the object_resolve_path_type with
an if.

Reviewed-by: Paolo Bonzini <address@hidden>

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;
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]