[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] hw: do not pass NULL to memory_r
From: |
Thomas Huth |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] hw: do not pass NULL to memory_region_init from instance_init |
Date: |
Wed, 30 Sep 2015 10:30:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 |
On 29/09/15 14:37, Paolo Bonzini wrote:
> This causes the region to outlive the object, because it attaches the
> region to /machine. This is not nice for the "realize" method, but
> much worse for "instance_init" because it can cause dangling pointers
> after a simple object_new/object_unref pair.
>
> Reported-by: Markus Armbruster <address@hidden>
> Signed-off-by: Paolo Bonzini <address@hidden>
...
> diff --git a/hw/display/tcx.c b/hw/display/tcx.c
> index 4635800..bf119bc 100644
> --- a/hw/display/tcx.c
> +++ b/hw/display/tcx.c
> @@ -944,7 +944,7 @@ static void tcx_initfn(Object *obj)
> SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
> TCXState *s = TCX(obj);
>
> - memory_region_init_ram(&s->rom, NULL, "tcx.prom", FCODE_MAX_ROM_SIZE,
> + memory_region_init_ram(&s->rom, OBJECT(s), "tcx.prom",
> FCODE_MAX_ROM_SIZE,
> &error_fatal);
Why "OBJECT(s)" and not simply "obj" ?
Thomas
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] hw: do not pass NULL to memory_region_init from instance_init, Markus Armbruster, 2015/10/08
Re: [Qemu-ppc] [Qemu-devel] [PATCH 2/3] hw: do not pass NULL to memory_region_init from instance_init, Mark Cave-Ayland, 2015/10/08
[Qemu-ppc] [PATCH 3/3] macio: move DBDMA_init from instance_init to realize, Paolo Bonzini, 2015/10/05