Blob Blame History Raw
From: Jan Kara <jack@suse.cz>
Subject: x86/asm/memcpy_mcsafe: Provide original memcpy_mcsafe_unrolled
Patch-mainline: Never, kabi
References: bsc#1098782

Provide wrapper for new __memcpy_mcsafe() under the original name
memcpy_mcsafe_unrolled() to maintain kABI. Also the return value has changed to
return number of remaining bytes to copy so handle that as well.

Signed-off-by: Jan Kara <jack@suse.cz>

---
 arch/x86/include/asm/string_64.h |    2 ++
 arch/x86/lib/misc.c              |   13 +++++++++++++
 2 files changed, 15 insertions(+)

--- a/arch/x86/include/asm/string_64.h
+++ b/arch/x86/include/asm/string_64.h
@@ -111,6 +111,8 @@ memcpy_mcsafe(void *dst, const void *src
 	return 0;
 }
 
+__must_check int memcpy_mcsafe_unrolled(void *dst, const void *src, size_t cnt);
+
 #ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE
 #define __HAVE_ARCH_MEMCPY_FLUSHCACHE 1
 void memcpy_flushcache(void *dst, const void *src, size_t cnt);
--- a/arch/x86/lib/misc.c
+++ b/arch/x86/lib/misc.c
@@ -1,3 +1,7 @@
+#include <linux/export.h>
+#include <linux/errno.h>
+#include <asm/string.h>
+
 /*
  * Count the digits of @val including a possible sign.
  *
@@ -19,3 +23,12 @@ int num_digits(int val)
 	}
 	return d;
 }
+
+#ifndef CONFIG_X86_32
+/* Provide kABI wrapper under original name */
+__must_check int memcpy_mcsafe_unrolled(void *dst, const void *src, size_t cnt)
+{
+	return __memcpy_mcsafe(dst, src, cnt) ? -EFAULT : 0;
+}
+EXPORT_SYMBOL_GPL(memcpy_mcsafe_unrolled);
+#endif