[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation |
Date: |
Wed, 5 May 2021 23:10:35 +0200 |
Use autofree heap allocation instead of variable-length
array on the stack.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
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 68f9d44feb4..c293d00d5c4 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -566,8 +566,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.26.3
- Re: [PATCH 07/23] hw/block/nvme: Use definition to avoid dynamic stack allocation, (continued)
- [PATCH 08/23] hw/block/nvme: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 09/23] hw/net/e1000e_core: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 10/23] hw/ppc/pnv: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 11/23] hw/intc/xics: Avoid dynamic stack allocation,
Philippe Mathieu-Daudé <=
- [PATCH 12/23] hw/i386/multiboot: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 13/23] hw/usb/hcd-xhci: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 14/23] hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 15/23] net: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05