All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"Greg Kurz" <groug@kaod.org>,
	qemu-ppc@nongnu.org, "Hervé Poussineau" <hpoussin@reactos.org>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 6/6] hw/isa/piix4: Fix leak removing unuseful qemu_allocate_irqs() call
Date: Thu, 15 Apr 2021 12:30:36 +0200	[thread overview]
Message-ID: <1083a368-1582-3539-27e4-c05205c305cf@amsat.org> (raw)
In-Reply-To: <20210323231358.396520-7-f4bug@amsat.org>

ping for review?

On 3/24/21 12:13 AM, Philippe Mathieu-Daudé wrote:
> We locally create an input IRQ with qemu_allocate_irqs() to
> pass it as output IRQ of the PIC, but its handler simply dispatch
> into another of our output IRQ ("intr" output).
> 
> Simplify by directly connecting the PIC output to our "intr"
> output.
> 
> This fixes when using QEMU built with --enable-sanitizers:
> 
>   ==338425==ERROR: LeakSanitizer: detected memory leaks
> 
>   Direct leak of 8 byte(s) in 1 object(s) allocated from:
>     #0 0x5641b361e1df in malloc (qemu-system-mips+0x1b201df)
>     #1 0x7f995e683958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
>     #2 0x5641b5558e36 in qemu_allocate_irqs hw/core/irq.c:66:12
>     #3 0x5641b4161817 in piix4_realize hw/isa/piix4.c:171:21
>     #4 0x5641b42f077a in pci_qdev_realize hw/pci/pci.c:2114:9
>     #5 0x5641b554c802 in device_set_realized hw/core/qdev.c:761:13
>     #6 0x5641b5578458 in property_set_bool qom/object.c:2257:5
>     #7 0x5641b55709e2 in object_property_set qom/object.c:1402:5
>     #8 0x5641b55861c9 in object_property_set_qobject qom/qom-qobject.c:28:10
>     #9 0x5641b5571831 in object_property_set_bool qom/object.c:1472:15
>    #10 0x5641b55410fd in qdev_realize hw/core/qdev.c:389:12
> 
> Fixes: 078778c5a55 ("piix4: Add an i8259 Interrupt Controller as specified in datasheet")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/isa/piix4.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c
> index a50d97834c7..79ed20e2a1a 100644
> --- a/hw/isa/piix4.c
> +++ b/hw/isa/piix4.c
> @@ -103,12 +103,6 @@ static const VMStateDescription vmstate_piix4 = {
>      }
>  };
>  
> -static void piix4_request_i8259_irq(void *opaque, int irq, int level)
> -{
> -    PIIX4State *s = opaque;
> -    qemu_set_irq(s->cpu_intr, level);
> -}
> -
>  static void piix4_set_i8259_irq(void *opaque, int irq, int level)
>  {
>      PIIX4State *s = opaque;
> @@ -149,7 +143,6 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
>  {
>      PIIX4State *s = PIIX4_PCI_DEVICE(dev);
>      ISABus *isa_bus;
> -    qemu_irq *i8259_out_irq;
>  
>      isa_bus = isa_bus_new(DEVICE(dev), pci_address_space(dev),
>                            pci_address_space_io(dev), errp);
> @@ -168,8 +161,7 @@ static void piix4_realize(PCIDevice *dev, Error **errp)
>                                          PIIX_RCR_IOPORT, &s->rcr_mem, 1);
>  
>      /* initialize i8259 pic */
> -    i8259_out_irq = qemu_allocate_irqs(piix4_request_i8259_irq, s, 1);
> -    s->isa = i8259_init(isa_bus, *i8259_out_irq);
> +    s->isa = i8259_init(isa_bus, s->cpu_intr);
>  
>      /* initialize ISA irqs */
>      isa_bus_irqs(isa_bus, s->isa);
> 


  reply	other threads:[~2021-04-15 10:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 23:13 [PATCH 0/6] hw/isa: Remove unuseful qemu_allocate_irqs() call Philippe Mathieu-Daudé
2021-03-23 23:13 ` [PATCH 1/6] hw/isa/i82378: Name output IRQ as 'intr' Philippe Mathieu-Daudé
2021-03-23 23:13 ` [PATCH 2/6] hw/isa/i82378: Simplify removing unuseful qemu_allocate_irqs() call Philippe Mathieu-Daudé
2021-03-23 23:13 ` [PATCH 3/6] hw/isa/i82378: Rename output IRQ variable Philippe Mathieu-Daudé
2021-03-23 23:13 ` [PATCH 4/6] hw/isa/vt82c686: Name output IRQ as 'intr' Philippe Mathieu-Daudé
2021-03-23 23:13 ` [PATCH 5/6] hw/isa/vt82c686: Simplify removing unuseful qemu_allocate_irqs() call Philippe Mathieu-Daudé
2021-03-23 23:43   ` BALATON Zoltan
2021-04-27 12:57     ` Philippe Mathieu-Daudé
2021-03-23 23:13 ` [PATCH 6/6] hw/isa/piix4: Fix leak " Philippe Mathieu-Daudé
2021-04-15 10:30   ` Philippe Mathieu-Daudé [this message]
2021-04-27 12:58 ` [PATCH 0/6] hw/isa: Remove " Philippe Mathieu-Daudé

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=1083a368-1582-3539-27e4-c05205c305cf@amsat.org \
    --to=f4bug@amsat.org \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=aurelien@aurel32.net \
    --cc=chenhuacai@kernel.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=hpoussin@reactos.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.