]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
target/ppc/kvm: Replace variable length array in kvmppc_save_htab()
authorThomas Huth <thuth@redhat.com>
Wed, 21 Feb 2024 16:26:34 +0000 (17:26 +0100)
committerThomas Huth <thuth@redhat.com>
Fri, 23 Feb 2024 07:13:52 +0000 (08:13 +0100)
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>
target/ppc/kvm.c

index 26fa9d057576856fa61651d9e5a2896230a539bb..e7e39c309113167e9723b55a6e55f0725b442e5c 100644 (file)
@@ -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 {