aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc/spapr_pci_nvlink2.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@redhat.com>2022-08-19 16:39:26 +0100
committerPeter Maydell <peter.maydell@linaro.org>2022-09-22 16:38:28 +0100
commita580fdcd609e1db77ef5a1cbcbfd2af5ca05c939 (patch)
treee759cbd92efa60c75de43cd2aac08bc09118ddbd /hw/ppc/spapr_pci_nvlink2.c
parentc140a69055bad798a335ea3c83aebceaca82bde0 (diff)
hw/ppc/pnv: Avoid dynamic stack allocation
Use autofree heap allocation instead of variable-length array on the stack. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Message-id: 20220819153931.3147384-7-peter.maydell@linaro.org
Diffstat (limited to 'hw/ppc/spapr_pci_nvlink2.c')
-rw-r--r--hw/ppc/spapr_pci_nvlink2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/ppc/spapr_pci_nvlink2.c b/hw/ppc/spapr_pci_nvlink2.c
index 63b476c8f7..2a8a11be1d 100644
--- a/hw/ppc/spapr_pci_nvlink2.c
+++ b/hw/ppc/spapr_pci_nvlink2.c
@@ -397,7 +397,7 @@ void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int offset,
continue;
}
if (dev == nvslot->gpdev) {
- uint32_t npus[nvslot->linknum];
+ g_autofree uint32_t *npus = g_new(uint32_t, nvslot->linknum);
for (j = 0; j < nvslot->linknum; ++j) {
PCIDevice *npdev = nvslot->links[j].npdev;