From: Stefan Weil <sw@weilnetz.de> To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, "Richard Henderson" <richard.henderson@linaro.org>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, "Stefan Weil" <sw@weilnetz.de> Subject: [PATCH] util/oslib-win32: Fix fatal assertion in qemu_try_memalign Date: Fri, 11 Jun 2021 12:58:46 +0200 [thread overview] Message-ID: <20210611105846.347954-1-sw@weilnetz.de> (raw) The function is called with alignment == 0 which caused an assertion. Use the code from oslib_posix.c to fix that regression (introduced by commit ed6f53f9ca9). Signed-off-by: Stefan Weil <sw@weilnetz.de> --- 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 ca99356fdf..7b318ea835 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -57,7 +57,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.30.2
next reply other threads:[~2021-06-11 10:59 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-11 10:58 Stefan Weil [this message] 2021-06-11 11:06 ` Philippe Mathieu-Daudé 2021-06-11 11:12 ` Stefan Weil 2021-06-19 15:48 ` Richard Henderson
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210611105846.347954-1-sw@weilnetz.de \ --to=sw@weilnetz.de \ --cc=philmd@redhat.com \ --cc=qemu-devel@nongnu.org \ --cc=qemu-trivial@nongnu.org \ --cc=richard.henderson@linaro.org \ --subject='Re: [PATCH] util/oslib-win32: Fix fatal assertion in qemu_try_memalign' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.