summaryrefslogtreecommitdiffstats
path: root/arch/openrisc
diff options
context:
space:
mode:
authorStafford Horne <shorne@gmail.com>2019-01-08 22:15:15 +0900
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-08 18:22:30 -0800
commit9cb2feb4d21d97386eb25c7b67e2793efcc1e70a (patch)
treedb21536a3185148f4289bccf17eece5f4cbc04c8 /arch/openrisc
parent7b55851367136b1efd84d98fea81ba57a98304cf (diff)
downloadlinux-9cb2feb4d21d97386eb25c7b67e2793efcc1e70a.tar.gz
linux-9cb2feb4d21d97386eb25c7b67e2793efcc1e70a.tar.bz2
linux-9cb2feb4d21d97386eb25c7b67e2793efcc1e70a.zip
arch/openrisc: Fix issues with access_ok()
The commit 594cc251fdd0 ("make 'user_access_begin()' do 'access_ok()'") exposed incorrect implementations of access_ok() macro in several architectures. This change fixes 2 issues found in OpenRISC. OpenRISC was not properly using parenthesis for arguments and also using arguments twice. This patch fixes those 2 issues. I test booted this patch with v5.0-rc1 on qemu and it's working fine. Cc: Guenter Roeck <linux@roeck-us.net> Cc: Linus Torvalds <torvalds@linux-foundation.org> Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Stafford Horne <shorne@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/openrisc')
-rw-r--r--arch/openrisc/include/asm/uaccess.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h
index bc8191a34db7..a44682c8adc3 100644
--- a/arch/openrisc/include/asm/uaccess.h
+++ b/arch/openrisc/include/asm/uaccess.h
@@ -58,8 +58,12 @@
/* Ensure that addr is below task's addr_limit */
#define __addr_ok(addr) ((unsigned long) addr < get_fs())
-#define access_ok(addr, size) \
- __range_ok((unsigned long)addr, (unsigned long)size)
+#define access_ok(addr, size) \
+({ \
+ unsigned long __ao_addr = (unsigned long)(addr); \
+ unsigned long __ao_size = (unsigned long)(size); \
+ __range_ok(__ao_addr, __ao_size); \
+})
/*
* These are the main single-value transfer routines. They automatically