]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.165/x86-boot-undef-memcpy-et-al-in-string.c.patch
drop drm patch
[thirdparty/kernel/stable-queue.git] / releases / 4.4.165 / x86-boot-undef-memcpy-et-al-in-string.c.patch
1 From foo@baz Wed Nov 21 18:50:39 CET 2018
2 From: Michael Davidson <md@google.com>
3 Date: Mon, 24 Jul 2017 16:51:55 -0700
4 Subject: x86/boot: #undef memcpy() et al in string.c
5
6 From: Michael Davidson <md@google.com>
7
8 commit 18d5e6c34a8eda438d5ad8b3b15f42dab01bf05d upstream.
9
10 undef memcpy() and friends in boot/string.c so that the functions
11 defined here will have the correct names, otherwise we end up
12 up trying to redefine __builtin_memcpy() etc.
13
14 Surprisingly, GCC allows this (and, helpfully, discards the
15 __builtin_ prefix from the function name when compiling it),
16 but clang does not.
17
18 Adding these #undef's appears to preserve what I assume was
19 the original intent of the code.
20
21 Signed-off-by: Michael Davidson <md@google.com>
22 Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
23 Acked-by: H. Peter Anvin <hpa@zytor.com>
24 Cc: Arnd Bergmann <arnd@arndb.de>
25 Cc: Bernhard.Rosenkranzer@linaro.org
26 Cc: Greg Hackmann <ghackmann@google.com>
27 Cc: Kees Cook <keescook@chromium.org>
28 Cc: Linus Torvalds <torvalds@linux-foundation.org>
29 Cc: Nick Desaulniers <ndesaulniers@google.com>
30 Cc: Peter Zijlstra <peterz@infradead.org>
31 Cc: Thomas Gleixner <tglx@linutronix.de>
32 Link: http://lkml.kernel.org/r/20170724235155.79255-1-mka@chromium.org
33 Signed-off-by: Ingo Molnar <mingo@kernel.org>
34 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36 ---
37 arch/x86/boot/string.c | 9 +++++++++
38 1 file changed, 9 insertions(+)
39
40 --- a/arch/x86/boot/string.c
41 +++ b/arch/x86/boot/string.c
42 @@ -16,6 +16,15 @@
43 #include "ctype.h"
44 #include "string.h"
45
46 +/*
47 + * Undef these macros so that the functions that we provide
48 + * here will have the correct names regardless of how string.h
49 + * may have chosen to #define them.
50 + */
51 +#undef memcpy
52 +#undef memset
53 +#undef memcmp
54 +
55 int memcmp(const void *s1, const void *s2, size_t len)
56 {
57 u8 diff;