qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/9] util/oslib-win32: Return NULL on qemu_try_memalign() wit


From: Richard Henderson
Subject: Re: [PATCH 4/9] util/oslib-win32: Return NULL on qemu_try_memalign() with zero size
Date: Sun, 27 Feb 2022 08:36:50 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 2/27/22 02:54, Peter Maydell wrote:
+    if (size) {
+        ptr = _aligned_malloc(size, alignment);
+    } else {
+        ptr = NULL;
+    }

Oh, should we set errno to something here?
Otherwise a random value will be used by qemu_memalign.

Yeah, I guess so, though the errno to use isn't obvious. Maybe EINVAL?

The alternative would be to try to audit all the callsites to
confirm they don't ever try to allocate 0 bytes and then have
the assert for both Windows and POSIX versions...

Alternately, force size == 1, so that we always get a non-NULL value that can be freed. That's a change on the POSIX side as well, of course.


r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]