qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 12/17] hw/cpu/arm11mpcore: Fix introspection


From: Alistair Francis
Subject: Re: [Qemu-devel] [PATCH v3 12/17] hw/cpu/arm11mpcore: Fix introspection problem with 'arm11mpcore_priv'
Date: Mon, 16 Jul 2018 15:06:37 -0700

On Mon, Jul 16, 2018 at 5:59 AM, Thomas Huth <address@hidden> wrote:
> Valgrind reports an error here:
>
> echo "{'execute':'qmp_capabilities'} {'execute':'device-list-properties'," \
>  "'arguments':{'typename':'arm11mpcore_priv'}}" \
>  "{'execute': 'human-monitor-command', " \
>  "'arguments': {'command-line': 'info qtree'}}" | \
>  valgrind -q aarch64-softmmu/qemu-system-aarch64 -M none,accel=qtest -qmp 
> stdio
> [...]
> ==3145== Invalid read of size 8
> ==3145==    at 0x61873A: qdev_print (qdev-monitor.c:686)
> ==3145==    by 0x61873A: qbus_print (qdev-monitor.c:719)
> [...]
>
> Use sysbus_init_child_obj() to fix it.
>
> Reviewed-by: Richard Henderson <address@hidden>
> Reviewed-by: Paolo Bonzini <address@hidden>
> Reviewed-by: Eduardo Habkost <address@hidden>
> Signed-off-by: Thomas Huth <address@hidden>

Reviewed-by: Alistair Francis <address@hidden>

Alistair

> ---
>  hw/cpu/arm11mpcore.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c
> index eb24465..8aead37 100644
> --- a/hw/cpu/arm11mpcore.c
> +++ b/hw/cpu/arm11mpcore.c
> @@ -121,19 +121,17 @@ static void mpcore_priv_initfn(Object *obj)
>                         "mpcore-priv-container", 0x2000);
>      sysbus_init_mmio(sbd, &s->container);
>
> -    object_initialize(&s->scu, sizeof(s->scu), TYPE_ARM11_SCU);
> -    qdev_set_parent_bus(DEVICE(&s->scu), sysbus_get_default());
> +    sysbus_init_child_obj(obj, "scu", &s->scu, sizeof(s->scu), 
> TYPE_ARM11_SCU);
>
> -    object_initialize(&s->gic, sizeof(s->gic), TYPE_ARM_GIC);
> -    qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default());
> +    sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), TYPE_ARM_GIC);
>      /* Request the legacy 11MPCore GIC behaviour: */
>      qdev_prop_set_uint32(DEVICE(&s->gic), "revision", 0);
>
> -    object_initialize(&s->mptimer, sizeof(s->mptimer), TYPE_ARM_MPTIMER);
> -    qdev_set_parent_bus(DEVICE(&s->mptimer), sysbus_get_default());
> +    sysbus_init_child_obj(obj, "mptimer", &s->mptimer, sizeof(s->mptimer),
> +                          TYPE_ARM_MPTIMER);
>
> -    object_initialize(&s->wdtimer, sizeof(s->wdtimer), TYPE_ARM_MPTIMER);
> -    qdev_set_parent_bus(DEVICE(&s->wdtimer), sysbus_get_default());
> +    sysbus_init_child_obj(obj, "wdtimer", &s->wdtimer, sizeof(s->wdtimer),
> +                          TYPE_ARM_MPTIMER);
>  }
>
>  static Property mpcore_priv_properties[] = {
> --
> 1.8.3.1
>
>



reply via email to

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