[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast retu
From: |
Alistair Francis |
Subject: |
Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type |
Date: |
Mon, 17 Aug 2015 15:24:02 -0700 |
On Sat, Aug 15, 2015 at 2:22 PM, Peter Crosthwaite
<address@hidden> wrote:
> On Mon, Jul 27, 2015 at 11:37 AM, Alistair Francis
> <address@hidden> wrote:
>> If the ObjectClass has no type return NULL instead of trying to compare
>> the type name.
>>
>
> What was the issue?
There is a seg fault in object_class_dynamic_cast() because there is
no type in the ObjectClass struct.
It happens when it is trying to cast the "pci-device", which is called
from the ahci_irq_lower() function. The function is testing if the
device is a pci device, so it should return NULL if it isn't valid.
Thanks,
Alistair
>
> Regards,
> Peter
>
>> Signed-off-by: Alistair Francis <address@hidden>
>> Reviewed-by: Sai Pavan Boddu <address@hidden>
>> ---
>> qom/object.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/qom/object.c b/qom/object.c
>> index eea8edf..2d6d715 100644
>> --- a/qom/object.c
>> +++ b/qom/object.c
>> @@ -603,7 +603,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass
>> *class,
>> TypeImpl *target_type;
>> TypeImpl *type;
>>
>> - if (!class) {
>> + if (!class || !class->type) {
>> return NULL;
>> }
>>
>> --
>> 1.7.1
>>
>>
>
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Peter Crosthwaite, 2015/08/15
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type,
Alistair Francis <=
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Andreas Färber, 2015/08/18
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Peter Crosthwaite, 2015/08/18
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Alistair Francis, 2015/08/24
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Peter Crosthwaite, 2015/08/25
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Alistair Francis, 2015/08/26
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Peter Crosthwaite, 2015/08/26
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, John Snow, 2015/08/26
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Peter Crosthwaite, 2015/08/26
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, Peter Maydell, 2015/08/26
- Re: [Qemu-devel] [PATCH v1 2/3] object.c: object_class_dynamic_cast return NULL if the class has no type, John Snow, 2015/08/26