[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation
From: |
David Gibson |
Subject: |
Re: [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation |
Date: |
Thu, 6 May 2021 12:16:29 +1000 |
On Wed, May 05, 2021 at 11:10:45PM +0200, Philippe Mathieu-Daudé wrote:
> 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>
> ---
> target/ppc/kvm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
> index ae62daddf7d..90d0230eb86 100644
> --- a/target/ppc/kvm.c
> +++ b/target/ppc/kvm.c
> @@ -2660,7 +2660,7 @@ int kvmppc_get_htab_fd(bool write, uint64_t index,
> Error **errp)
> int kvmppc_save_htab(QEMUFile *f, int fd, size_t bufsize, int64_t max_ns)
> {
> int64_t starttime = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
> - uint8_t buf[bufsize];
> + g_autofree uint8_t *buf = g_malloc(bufsize);
> ssize_t rc;
>
> do {
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
signature.asc
Description: PGP signature
- Re: [PATCH 15/23] net: Avoid dynamic stack allocation, (continued)
- [PATCH 16/23] ui/curses: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 17/23] ui/spice-display: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 18/23] ui/vnc-enc-hextile: Use definitions to avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 19/23] ui/vnc-enc-tight: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 20/23] util/iov: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- Re: [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation,
David Gibson <=
- [PATCH 22/23] tests/unit/test-vmstate: Avoid dynamic stack allocation, Philippe Mathieu-Daudé, 2021/05/05
- [PATCH 23/23] configure: Prohibit variable-length allocations by using -Wvla CPPFLAG, Philippe Mathieu-Daudé, 2021/05/05