From: Jan Beulich Date: Thu, 4 Feb 2021 12:59:56 +0000 (+0100) Subject: x86/string: correct memmove()'s forwarding to memcpy() X-Git-Tag: archive/raspbian/4.16.0+51-g0941d6cb-1+rpi1~2^2~42^2~951 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=7b93d92a35dc7c0a6e5f1f79b3c887aa3e66ddc0;p=xen.git x86/string: correct memmove()'s forwarding to memcpy() With memcpy() expanding to the compiler builtin, we may not hand it overlapping source and destination. We strictly mean to forward to our own implementation (a few lines up in the same source file). Fixes: 78825e1c60fa ("x86/string: Clean up x86/string.h") Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- diff --git a/xen/arch/x86/string.c b/xen/arch/x86/string.c index e2f84638c4..bda24b14ac 100644 --- a/xen/arch/x86/string.c +++ b/xen/arch/x86/string.c @@ -43,7 +43,8 @@ void *(memmove)(void *dest, const void *src, size_t n) return dest; if ( dest < src ) - return memcpy(dest, src, n); + /* Depends on Xen's implementation operating forwards. */ + return (memcpy)(dest, src, n); asm volatile ( " std ; "