From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk,
qemu-devel@nongnu.org, agraf@suse.de, blauwirbel@gmail.com,
qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] hw: do not pass NULL to memory_region_init from instance_init
Date: Thu, 1 Oct 2015 12:13:05 +0200 [thread overview]
Message-ID: <560D0731.40406@redhat.com> (raw)
In-Reply-To: <87io6rdoli.fsf@blackfin.pond.sub.org>
On 01/10/2015 09:39, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
>
>> On 30/09/2015 10:57, Markus Armbruster wrote:
>>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>>
>>>>> 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 <armbru@redhat.com>
>>>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> One more: pxa2xx_pcmcia_initfn().
>>>
>>> The ones you fix are
>>> Tested-by: Markus Armbruster <armbru@redhat.com>
>>
>> Can you fix it up and take it through your series?
>
> Like this?
>
> From 14ce586f3e8a7ced07ec37ed60ad71ca55f41a08 Mon Sep 17 00:00:00 2001
> From: Markus Armbruster <armbru@redhat.com>
> Date: Thu, 1 Oct 2015 09:36:39 +0200
> Subject: [PATCH] fixup! hw: do not pass NULL to memory_region_init from
> instance_init
>
> ---
> hw/pcmcia/pxa2xx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/hw/pcmcia/pxa2xx.c b/hw/pcmcia/pxa2xx.c
> index e0de8a6..23649bc 100644
> --- a/hw/pcmcia/pxa2xx.c
> +++ b/hw/pcmcia/pxa2xx.c
> @@ -163,7 +163,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)
> sysbus_init_mmio(sbd, &s->container_mem);
>
> /* Socket I/O Memory Space */
> - memory_region_init_io(&s->iomem, NULL, &pxa2xx_pcmcia_io_ops, s,
> + memory_region_init_io(&s->iomem, obj, &pxa2xx_pcmcia_io_ops, s,
> "pxa2xx-pcmcia-io", 0x04000000);
> memory_region_add_subregion(&s->container_mem, 0x00000000,
> &s->iomem);
> @@ -171,13 +171,13 @@ static void pxa2xx_pcmcia_initfn(Object *obj)
> /* Then next 64 MB is reserved */
>
> /* Socket Attribute Memory Space */
> - memory_region_init_io(&s->attr_iomem, NULL, &pxa2xx_pcmcia_attr_ops, s,
> + memory_region_init_io(&s->attr_iomem, obj, &pxa2xx_pcmcia_attr_ops, s,
> "pxa2xx-pcmcia-attribute", 0x04000000);
> memory_region_add_subregion(&s->container_mem, 0x08000000,
> &s->attr_iomem);
>
> /* Socket Common Memory Space */
> - memory_region_init_io(&s->common_iomem, NULL, &pxa2xx_pcmcia_common_ops, s,
> + memory_region_init_io(&s->common_iomem, obj, &pxa2xx_pcmcia_common_ops, s,
> "pxa2xx-pcmcia-common", 0x04000000);
> memory_region_add_subregion(&s->container_mem, 0x0c000000,
> &s->common_iomem);
>
Yes, thanks!
Paolo
next prev parent reply other threads:[~2015-10-01 10:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 12:37 [Qemu-devel] [PATCH 0/3] Fix dangling pointers from memory_region_init_* Paolo Bonzini
2015-09-29 12:37 ` [Qemu-devel] [PATCH 1/3] memory: allow destroying a non-empty MemoryRegion Paolo Bonzini
2015-09-29 12:37 ` [Qemu-devel] [PATCH 2/3] hw: do not pass NULL to memory_region_init from instance_init Paolo Bonzini
2015-09-29 12:42 ` Peter Maydell
2015-09-30 8:30 ` Thomas Huth
2015-09-30 13:04 ` Paolo Bonzini
2015-10-01 7:39 ` Markus Armbruster
2015-10-01 8:26 ` Markus Armbruster
2015-10-01 9:27 ` Peter Maydell
2015-09-30 8:57 ` Markus Armbruster
2015-09-30 13:03 ` Paolo Bonzini
2015-10-01 7:39 ` Markus Armbruster
2015-10-01 10:13 ` Paolo Bonzini [this message]
2015-10-01 9:38 ` Mark Cave-Ayland
2015-09-29 12:37 ` [Qemu-devel] [PATCH 3/3] macio: move DBDMA_init from instance_init to realize Paolo Bonzini
2015-09-30 8:33 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560D0731.40406@redhat.com \
--to=pbonzini@redhat.com \
--cc=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).