diff options
authorArnd Bergmann <>2018-07-26 10:13:23 +0200
committerMax Krummenacher <>2018-09-12 10:21:52 +0200
commit248c6a9a658f061f4f4ee0ea467c67f0c3655ebf (patch)
parent762a3f2c5de2b9f6070e0eefb81c3a762d587ca8 (diff)
ARM: fix put_user() for gcc-8
Building kernels before linux-4.7 with gcc-8 results in many build failures when gcc triggers a check that was meant to catch broken compilers: /tmp/ccCGMQmS.s:648: Error: .err encountered According to the discussion in the gcc bugzilla, a local "register asm()" variable is still supposed to be the correct way to force an inline assembly to use a particular register, but marking it 'const' lets the compiler do optimizations that break that, i.e the compiler is free to treat the variable as either 'const' or 'register' in that case. Upstream commit 9f73bd8bb445 ("ARM: uaccess: remove put_user() code duplication") fixed this problem in linux-4.8 as part of a larger change, but seems a little too big to be backported to 4.4. Let's take the simplest fix and change only the one broken line in the same way as newer kernels. Suggested-by: Bernd Edlinger <> Link: Link: Signed-off-by: Arnd Bergmann <> Signed-off-by: Greg Kroah-Hartman <> (cherry picked from commit 0ca85fc310e8c24cba10ed241a0188795e177683) /tmp/ccmcXtfu.s: Assembler messages: /tmp/ccmcXtfu.s:1441: Error: .err encountered Signed-off-by: Max Krummenacher <> Conflicts: arch/arm/include/asm/uaccess.h
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
index b293616a1a1a..4afe3d42a5c5 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -145,7 +145,7 @@ extern int __put_user_8(void *, unsigned long long);
#define put_user(x,p) \
({ \
- register const typeof(*(p)) __r2 asm("r2") = (x); \
+ register typeof(*(p)) __r2 asm("r2") = (x); \
register const typeof(*(p)) __user *__p asm("r0") = (p);\
register int __e asm("r0"); \
switch (sizeof(*(__p))) { \