]> xenbits.xensource.com Git - xen.git/commitdiff
x86/string: correct memmove()'s forwarding to memcpy()
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Feb 2021 12:59:56 +0000 (13:59 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Feb 2021 12:59:56 +0000 (13:59 +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>
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         ; "