From 2eae57b784c362d1e3aeb8f2b4c5796faaf91ac3 Mon Sep 17 00:00:00 2001 From: tangbinzy Date: Sat, 12 Oct 2024 09:04:19 +0000 Subject: [PATCH] hw/intc/xics: Avoid dynamic stack allocation mainline inclusion commit 7650c8fe520c67c3b36f6962c4ad990f56ad40b8 category: bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------------------------------------------------------------- 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 Signed-off-by: tangbinzy --- hw/intc/xics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 48a835eab7..9215ef1fb5 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -565,8 +565,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; -- 2.41.0.windows.1