diff options
Diffstat (limited to 'arch/parisc/include/asm/uaccess.h')
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 63f4dd0b49c2..4006964d8e12 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -4,14 +4,11 @@ | |||
4 | /* | 4 | /* |
5 | * User space memory access functions | 5 | * User space memory access functions |
6 | */ | 6 | */ |
7 | #include <asm/processor.h> | ||
8 | #include <asm/page.h> | 7 | #include <asm/page.h> |
9 | #include <asm/cache.h> | 8 | #include <asm/cache.h> |
10 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
11 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
12 | 11 | ||
13 | #include <linux/sched.h> | ||
14 | |||
15 | #define VERIFY_READ 0 | 12 | #define VERIFY_READ 0 |
16 | #define VERIFY_WRITE 1 | 13 | #define VERIFY_WRITE 1 |
17 | 14 | ||
@@ -36,43 +33,12 @@ extern int __get_user_bad(void); | |||
36 | extern int __put_kernel_bad(void); | 33 | extern int __put_kernel_bad(void); |
37 | extern int __put_user_bad(void); | 34 | extern int __put_user_bad(void); |
38 | 35 | ||
39 | 36 | static inline long access_ok(int type, const void __user * addr, | |
40 | /* | 37 | unsigned long size) |
41 | * Test whether a block of memory is a valid user space address. | ||
42 | * Returns 0 if the range is valid, nonzero otherwise. | ||
43 | */ | ||
44 | static inline int __range_not_ok(unsigned long addr, unsigned long size, | ||
45 | unsigned long limit) | ||
46 | { | 38 | { |
47 | unsigned long __newaddr = addr + size; | 39 | return 1; |
48 | return (__newaddr < addr || __newaddr > limit || size > limit); | ||
49 | } | 40 | } |
50 | 41 | ||
51 | /** | ||
52 | * access_ok: - Checks if a user space pointer is valid | ||
53 | * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that | ||
54 | * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe | ||
55 | * to write to a block, it is always safe to read from it. | ||
56 | * @addr: User space pointer to start of block to check | ||
57 | * @size: Size of block to check | ||
58 | * | ||
59 | * Context: User context only. This function may sleep. | ||
60 | * | ||
61 | * Checks if a pointer to a block of memory in user space is valid. | ||
62 | * | ||
63 | * Returns true (nonzero) if the memory block may be valid, false (zero) | ||
64 | * if it is definitely invalid. | ||
65 | * | ||
66 | * Note that, depending on architecture, this function probably just | ||
67 | * checks that the pointer is in the user space range - after calling | ||
68 | * this function, memory access functions may still return -EFAULT. | ||
69 | */ | ||
70 | #define access_ok(type, addr, size) \ | ||
71 | ( __chk_user_ptr(addr), \ | ||
72 | !__range_not_ok((unsigned long) (__force void *) (addr), \ | ||
73 | size, user_addr_max()) \ | ||
74 | ) | ||
75 | |||
76 | #define put_user __put_user | 42 | #define put_user __put_user |
77 | #define get_user __get_user | 43 | #define get_user __get_user |
78 | 44 | ||
@@ -253,11 +219,7 @@ extern long lstrnlen_user(const char __user *,long); | |||
253 | /* | 219 | /* |
254 | * Complex access routines -- macros | 220 | * Complex access routines -- macros |
255 | */ | 221 | */ |
256 | #ifdef CONFIG_COMPAT | 222 | #define user_addr_max() (~0UL) |
257 | #define user_addr_max() (TASK_SIZE) | ||
258 | #else | ||
259 | #define user_addr_max() (DEFAULT_TASK_SIZE) | ||
260 | #endif | ||
261 | 223 | ||
262 | #define strnlen_user lstrnlen_user | 224 | #define strnlen_user lstrnlen_user |
263 | #define strlen_user(str) lstrnlen_user(str, 0x7fffffffL) | 225 | #define strlen_user(str) lstrnlen_user(str, 0x7fffffffL) |