From: Philippe Mathieu-Daudé Date: Fri, 19 Aug 2022 15:39:27 +0000 (+0100) Subject: hw/intc/xics: Avoid dynamic stack allocation X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7650c8fe520c67c3b36f6962c4ad990f56ad40b8;p=qemu.git hw/intc/xics: Avoid dynamic stack allocation Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daudé Acked-by: David Gibson Reviewed-by: Greg Kurz Signed-off-by: Peter Maydell Message-id: 20220819153931.3147384-8-peter.maydell@linaro.org --- diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 5b0b4d9624..dcd021af66 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -567,8 +567,8 @@ static void ics_reset_irq(ICSIRQState *irq) static void ics_reset(DeviceState *dev) { ICSState *ics = ICS(dev); + g_autofree uint8_t *flags = g_malloc(ics->nr_irqs); int i; - uint8_t flags[ics->nr_irqs]; for (i = 0; i < ics->nr_irqs; i++) { flags[i] = ics->irqs[i].flags;