aboutsummaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2024-02-21 17:26:34 +0100
committerThomas Huth <thuth@redhat.com>2024-02-23 08:13:52 +0100
commitaba594da9645aa6bdb4e2729df2755c186023ca3 (patch)
tree756c6208ec8c2edd3e41b5d878e7cf9c0e63ac12 /target
parent0e9a89193d06a3b03b1332c4115d8b822e5ab96c (diff)
target/ppc/kvm: Replace variable length array in kvmppc_save_htab()
To be able to compile QEMU with -Wvla (to prevent potential security issues), we need to get rid of the variable length array in the kvmppc_save_htab() function. Replace it with a heap allocation instead. Message-ID: <20240221162636.173136-2-thuth@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'target')
-rw-r--r--target/ppc/kvm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 26fa9d0575..e7e39c3091 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -2688,7 +2688,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 {