diff options
author | Elena Afanasova <eafanasova@gmail.com> | 2020-10-09 06:41:36 -0700 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2020-10-28 01:08:53 +1100 |
commit | 2d154d2694009f9294e34875059e3a650ee5110a (patch) | |
tree | 7fe1d7e4dd19f611d34ecf72d41ba98badd21a1a /hw/net/spapr_llan.c | |
parent | dff669d6a15fb92b063cb5aa691b4bb498727404 (diff) | |
download | qemu-2d154d2694009f9294e34875059e3a650ee5110a.zip qemu-2d154d2694009f9294e34875059e3a650ee5110a.tar.gz qemu-2d154d2694009f9294e34875059e3a650ee5110a.tar.bz2 |
hw/net: move allocation to the heap due to very large stack frame
[dwg] The stack frame itself probably isn't that big a deal, but
avoiding alloca() is generally recommended these days.
Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
Message-Id: <8f07132478469b35fb50a4706691e2b56b10a67b.camel@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/net/spapr_llan.c')
-rw-r--r-- | hw/net/spapr_llan.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c index 2093f1b..581320a 100644 --- a/hw/net/spapr_llan.c +++ b/hw/net/spapr_llan.c @@ -688,7 +688,8 @@ static target_ulong h_send_logical_lan(PowerPCCPU *cpu, SpaprVioDevice *sdev = spapr_vio_find_by_reg(spapr->vio_bus, reg); SpaprVioVlan *dev = VIO_SPAPR_VLAN_DEVICE(sdev); unsigned total_len; - uint8_t *lbuf, *p; + uint8_t *p; + g_autofree uint8_t *lbuf = NULL; int i, nbufs; int ret; @@ -729,7 +730,7 @@ static target_ulong h_send_logical_lan(PowerPCCPU *cpu, return H_RESOURCE; } - lbuf = alloca(total_len); + lbuf = g_malloc(total_len); p = lbuf; for (i = 0; i < nbufs; i++) { ret = spapr_vio_dma_read(sdev, VLAN_BD_ADDR(bufs[i]), |