[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/33] util/oslib-win32: Fix fatal assertion in qemu_try_memalign
From: |
Richard Henderson |
Subject: |
[PULL 33/33] util/oslib-win32: Fix fatal assertion in qemu_try_memalign |
Date: |
Sat, 19 Jun 2021 11:14:52 -0700 |
From: Stefan Weil <sw@weilnetz.de>
The function is called with alignment == 0 which caused an assertion.
Use the code from oslib-posix.c to fix that regression.
Fixes: ed6f53f9ca9
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210611105846.347954-1-sw@weilnetz.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
util/oslib-win32.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index ee3a3692d8..af559ef339 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -58,7 +58,11 @@ void *qemu_try_memalign(size_t alignment, size_t size)
void *ptr;
g_assert(size != 0);
- g_assert(is_power_of_2(alignment));
+ if (alignment < sizeof(void *)) {
+ alignment = sizeof(void *);
+ } else {
+ g_assert(is_power_of_2(alignment));
+ }
ptr = _aligned_malloc(size, alignment);
trace_qemu_memalign(alignment, size, ptr);
return ptr;
--
2.25.1
- [PULL 20/33] tcg/tci: Implement clz, ctz, ctpop, (continued)
- [PULL 20/33] tcg/tci: Implement clz, ctz, ctpop, Richard Henderson, 2021/06/19
- [PULL 15/33] tcg/tci: Change encoding to uint32_t units, Richard Henderson, 2021/06/19
- [PULL 16/33] tcg/tci: Implement goto_ptr, Richard Henderson, 2021/06/19
- [PULL 24/33] Revert "tcg/tci: Use exec/cpu_ldst.h interfaces", Richard Henderson, 2021/06/19
- [PULL 21/33] tcg/tci: Implement mulu2, muls2, Richard Henderson, 2021/06/19
- [PULL 23/33] tcg/tci: Split out tci_qemu_ld, tci_qemu_st, Richard Henderson, 2021/06/19
- [PULL 27/33] tests/tcg: Increase timeout for TCI, Richard Henderson, 2021/06/19
- [PULL 28/33] accel/tcg: Probe the proper permissions for atomic ops, Richard Henderson, 2021/06/19
- [PULL 29/33] tcg/sparc: Fix temp_allocate_frame vs sparc stack bias, Richard Henderson, 2021/06/19
- [PULL 32/33] tcg: expose TCGCond manipulation routines, Richard Henderson, 2021/06/19
- [PULL 33/33] util/oslib-win32: Fix fatal assertion in qemu_try_memalign,
Richard Henderson <=
- Re: [PULL 00/33] tcg patch queue, Richard Henderson, 2021/06/19