[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qom v2 2/4] hw: Fix qemu_allocate_irqs() leaks
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH qom v2 2/4] hw: Fix qemu_allocate_irqs() leaks |
Date: |
Fri, 27 Jun 2014 11:45:54 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
Am 18.06.2014 09:55, schrieb Peter Crosthwaite:
> From: Andreas Färber <address@hidden>
>
> Replace qemu_allocate_irqs(foo, bar, 1)[0]
> with qemu_allocate_irq(foo, bar, 0).
>
> This avoids leaking the dereferenced qemu_irq *.
>
> Cc: Kirill Batuzov <address@hidden>
> Cc: Markus Armbruster <address@hidden>
> Cc: Peter Maydell <address@hidden>
> Reviewed-by: Peter Crosthwaite <address@hidden>
> Reviewed-by: Peter Maydell <address@hidden>
> Signed-off-by: Andreas Färber <address@hidden>
> [PC Changes:
> * Applied change to instance in sh4/sh7750.c
> ]
> Signed-off-by: Peter Crosthwaite <address@hidden>
> ---
> Changed since 1:
> Applied change to instance in sh4/sh7750.c (Kirill review)
[...]
> diff --git a/hw/sh4/sh7750.c b/hw/sh4/sh7750.c
> index 4a39357..9ccd770 100644
> --- a/hw/sh4/sh7750.c
> +++ b/hw/sh4/sh7750.c
> @@ -838,6 +838,5 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion
> *sysmem)
> qemu_irq sh7750_irl(SH7750State *s)
> {
> sh_intc_toggle_source(sh_intc_source(&s->intc, IRL), 1, 0); /* enable */
> - return qemu_allocate_irqs(sh_intc_set_irl, sh_intc_source(&s->intc, IRL),
> - 1)[0];
> + return qemu_allocate_irq(sh_intc_set_irl, sh_intc_source(&s->intc, IRL),
> 1);
Thanks for catching this, my grep expression failed due to the line
break. But shouldn't this be 0 due to the zero-based index, as per my
commit message? Will fix up unless I hear objections.
Regards,
Andreas
> }
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg