[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initial
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child() |
Date: |
Fri, 13 Jul 2018 08:27:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
On 12/07/2018 19:09, Peter Maydell wrote:
>> That's the same what object_initialize() is doing (see above). Otherwise
>> all the callers have to cast their pointers with OBJECT() first.
> Casting with OBJECT() would not work, because it does a typecheck.
> At the point where something is calling object_initialize() or
> object_initialize_with_child(), the memory at 'childobj' has not
> been initialized, so a typecheck is impossible.
>
> It's only once the object has actually been initialized that
> the memory is a valid Object* that you can put through OBJECT().
OBJECT is special and just does a cast, because every pointer to a QOM
object would pass. However, your reasoning still applies: you should
not put through OBJECT() an object that hasn't been initialized yet,
just like you should not put it through DEVICE() or any of the macros
that _do_ perform the typecheck.
Paolo
- [Qemu-arm] [PATCH v1 0/5] Fix crashes with introspection, Thomas Huth, 2018/07/12
- [Qemu-arm] [PATCH 2/5] hw/core/sysbus: Add a function for creating and attaching an object, Thomas Huth, 2018/07/12
- [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Thomas Huth, 2018/07/12
- Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Eduardo Habkost, 2018/07/12
- Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Paolo Bonzini, 2018/07/13
- Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Thomas Huth, 2018/07/13
- Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Paolo Bonzini, 2018/07/13
- Re: [Qemu-arm] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Thomas Huth, 2018/07/13
Re: [Qemu-arm] [Qemu-devel] [PATCH 1/5] qom/object: Add a new function object_initialize_as_child(), Eduardo Habkost, 2018/07/12
[Qemu-arm] [PATCH 3/5] hw/arm/bcm2836: Fix crash with device_add bcm2837 on unsupported machines, Thomas Huth, 2018/07/12
[Qemu-arm] [PATCH 4/5] hw/arm/armv7: Fix crash when introspecting the "iotkit" device, Thomas Huth, 2018/07/12
[Qemu-arm] [PATCH 5/5] hw/cpu/a15mpcore: Fix introspection problem with the a15mpcore_priv device, Thomas Huth, 2018/07/12
Re: [Qemu-arm] [PATCH v1 0/5] Fix crashes with introspection, Paolo Bonzini, 2018/07/12
Re: [Qemu-arm] [PATCH v1 0/5] Fix crashes with introspection, Peter Maydell, 2018/07/12