x86/string: correct memmove()'s forwarding to memcpy()
authorJan Beulich <jbeulich@suse.com>
Fri, 5 Mar 2021 14:29:52 +0000 (15:29 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 5 Mar 2021 14:29:52 +0000 (15:29 +0100)
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 <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 7b93d92a35dc7c0a6e5f1f79b3c887aa3e66ddc0
master date: 2021-02-04 13:59:56 +0100

xen/arch/x86/string.c

index e2f84638c4b2921fecbca4141b8ee9c63c976144..bda24b14aca6849adafd5be5ee9786831efc08b0 100644 (file)
@@ -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         ; "