Skip to content

Commit

Permalink
s390/uaccess: fix access_ok compile warnings
Browse files Browse the repository at this point in the history
On s390 access_ok is a macro which discards all parameters and always
returns 1. This can result in compile warnings which warn about unused
variables like this:

fs/read_write.c: In function 'rw_copy_check_uvector':
fs/read_write.c:684:16: warning: unused variable 'buf' [-Wunused-variable]

Fix this by adding a __range_ok() function which consumes all parameters
but still always returns 1.

Signed-off-by: Heiko Carstens <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed May 30, 2012
1 parent 2e30db9 commit 491af99
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions arch/s390/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@

#define segment_eq(a,b) ((a).ar4 == (b).ar4)

#define __access_ok(addr, size) \
({ \
__chk_user_ptr(addr); \
1; \
static inline int __range_ok(unsigned long addr, unsigned long size)
{
return 1;
}

#define __access_ok(addr, size) \
({ \
__chk_user_ptr(addr); \
__range_ok((unsigned long)(addr), (size)); \
})

#define access_ok(type, addr, size) __access_ok(addr, size)
Expand Down

0 comments on commit 491af99

Please sign in to comment.