mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
Fixes this `-fsanitize=undefined` error: ``` test_x86_emulator.c:614:12: runtime error: null pointer passed as argument 1, which is declared to never be null /usr/include/string.h:44:28: note: nonnull attribute specified here SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior test_x86_emulator.c:614:12 ``` Although this is more of a grey area: I don't see anything in the standard that'd forbid calling `memcpy` with NULL and 0, but `glibc` does specify it as non-null, which allows the compiler to make optimizations assuming it never is NULL, so this is undefined behaviour only on glibc. Best to avoid the potential undefined behaviour though. Signed-off-by: Edwin Török <edwin.torok@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com>