* [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation
[not found] <20210505211047.1496765-1-philmd@redhat.com>
@ 2021-05-05 21:10 ` Philippe Mathieu-Daudé
2021-05-06 2:16 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-05 21:10 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Daniel P. Berrangé,
qemu-ppc, Gerd Hoffmann, Marc-André Lureau, Paolo Bonzini,
Richard Henderson, Philippe Mathieu-Daudé,
David Gibson, Greg Kurz, open list:Overall KVM CPUs
Use autofree heap allocation instead of variable-length
array on the stack.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
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 {
--
2.26.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation
2021-05-05 21:10 ` [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation Philippe Mathieu-Daudé
@ 2021-05-06 2:16 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2021-05-06 2:16 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-block, Daniel P. Berrangé,
qemu-ppc, Gerd Hoffmann, Marc-André Lureau, Paolo Bonzini,
Richard Henderson, Greg Kurz, open list:Overall KVM CPUs
[-- Attachment #1: Type: text/plain, Size: 1071 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-06 2:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20210505211047.1496765-1-philmd@redhat.com>
2021-05-05 21:10 ` [PATCH 21/23] target/ppc/kvm: Avoid dynamic stack allocation Philippe Mathieu-Daudé
2021-05-06 2:16 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).