openrisc: uaccess: Add user address space check to access_ok
authorStafford Horne <shorne@gmail.com>
Tue, 4 Aug 2020 01:41:54 +0000 (10:41 +0900)
committerStafford Horne <shorne@gmail.com>
Sat, 8 Aug 2020 22:57:21 +0000 (07:57 +0900)
Now that __user annotations are fixed for openrisc uaccess api's we can
add checking to the access_ok macro.  This patch adds the __chk_user_ptr
check, on normal builds the added check is a nop.

Signed-off-by: Stafford Horne <shorne@gmail.com>
Reviewed-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
arch/openrisc/include/asm/uaccess.h

index 85a55359b2448ef557bb73a93cefbaa6bde8710e..7c5892f567652c4905d56ae79bb865a17f725a2d 100644 (file)
@@ -57,6 +57,7 @@ static inline int __range_ok(unsigned long addr, unsigned long size)
 
 #define access_ok(addr, size)                                          \
 ({                                                                     \
+       __chk_user_ptr(addr);                                           \
        __range_ok((unsigned long)(addr), (size));                      \
 })