Skip to content

Commit 17fcd83

Browse files
committed
openrisc: uaccess: Fix sparse address space warnings
The OpenRISC user access functions put_user(), get_user() and clear_user() were missing proper sparse annotations. This generated warnings like the below. This patch adds the annotations to fix the warnings. Example warnings: net/ipv4/ip_sockglue.c:759:29: warning: incorrect type in argument 1 (different address spaces) net/ipv4/ip_sockglue.c:759:29: expected void const volatile [noderef] __user * net/ipv4/ip_sockglue.c:759:29: got int const *__gu_addr net/ipv4/ip_sockglue.c:764:29: warning: incorrect type in initializer (different address spaces) net/ipv4/ip_sockglue.c:764:29: expected unsigned char const *__gu_addr net/ipv4/ip_sockglue.c:764:29: got unsigned char [noderef] __user * Signed-off-by: Stafford Horne <[email protected]> Reviewed-by: Luc Van Oostenryck <[email protected]>
1 parent 045838b commit 17fcd83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/openrisc/include/asm/uaccess.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extern long __put_user_bad(void);
100100
#define __put_user_check(x, ptr, size) \
101101
({ \
102102
long __pu_err = -EFAULT; \
103-
__typeof__(*(ptr)) *__pu_addr = (ptr); \
103+
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
104104
if (access_ok(__pu_addr, size)) \
105105
__put_user_size((x), __pu_addr, (size), __pu_err); \
106106
__pu_err; \
@@ -173,7 +173,7 @@ struct __large_struct {
173173
#define __get_user_check(x, ptr, size) \
174174
({ \
175175
long __gu_err = -EFAULT, __gu_val = 0; \
176-
const __typeof__(*(ptr)) * __gu_addr = (ptr); \
176+
const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \
177177
if (access_ok(__gu_addr, size)) \
178178
__get_user_size(__gu_val, __gu_addr, (size), __gu_err); \
179179
(x) = (__force __typeof__(*(ptr)))__gu_val; \
@@ -248,10 +248,10 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long size)
248248
#define INLINE_COPY_FROM_USER
249249
#define INLINE_COPY_TO_USER
250250

251-
extern unsigned long __clear_user(void *addr, unsigned long size);
251+
extern unsigned long __clear_user(void __user *addr, unsigned long size);
252252

253253
static inline __must_check unsigned long
254-
clear_user(void *addr, unsigned long size)
254+
clear_user(void __user *addr, unsigned long size)
255255
{
256256
if (likely(access_ok(addr, size)))
257257
size = __clear_user(addr, size);

0 commit comments

Comments
 (0)