aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/uaccess.h
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-06-14 02:00:03 -0400
committerArnd Bergmann <arnd@arndb.de>2009-06-19 08:58:08 -0400
commita9ede5b355aabd667ed690f858c925a23927027b (patch)
treeee3fe26530679c33fa3aad5386e6961b3bf399e7 /include/asm-generic/uaccess.h
parent9844813f226f6d07e1544e915529cb88f4fcb868 (diff)
asm-generic: uaccess: fix up local access_ok() usage
There's no reason that I can see to use the short __access_ok() form directly when the access_ok() is clearer in intent and for most people, expands to the same C code (i.e. always specify the first field -- access type). Not all no-mmu systems lack memory protection, so the read/write could feasibly be checked. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include/asm-generic/uaccess.h')
-rw-r--r--include/asm-generic/uaccess.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 5dd511b62ce9..b218b8513d04 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -163,7 +163,7 @@ static inline __must_check long __copy_to_user(void __user *to,
163#define put_user(x, ptr) \ 163#define put_user(x, ptr) \
164({ \ 164({ \
165 might_sleep(); \ 165 might_sleep(); \
166 __access_ok(ptr, sizeof (*ptr)) ? \ 166 access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \
167 __put_user(x, ptr) : \ 167 __put_user(x, ptr) : \
168 -EFAULT; \ 168 -EFAULT; \
169}) 169})
@@ -219,7 +219,7 @@ extern int __put_user_bad(void) __attribute__((noreturn));
219#define get_user(x, ptr) \ 219#define get_user(x, ptr) \
220({ \ 220({ \
221 might_sleep(); \ 221 might_sleep(); \
222 __access_ok(ptr, sizeof (*ptr)) ? \ 222 access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \
223 __get_user(x, ptr) : \ 223 __get_user(x, ptr) : \
224 -EFAULT; \ 224 -EFAULT; \
225}) 225})
@@ -244,7 +244,7 @@ static inline long copy_from_user(void *to,
244 const void __user * from, unsigned long n) 244 const void __user * from, unsigned long n)
245{ 245{
246 might_sleep(); 246 might_sleep();
247 if (__access_ok(from, n)) 247 if (access_ok(VERIFY_READ, from, n))
248 return __copy_from_user(to, from, n); 248 return __copy_from_user(to, from, n);
249 else 249 else
250 return n; 250 return n;
@@ -254,7 +254,7 @@ static inline long copy_to_user(void __user *to,
254 const void *from, unsigned long n) 254 const void *from, unsigned long n)
255{ 255{
256 might_sleep(); 256 might_sleep();
257 if (__access_ok(to, n)) 257 if (access_ok(VERIFY_WRITE, to, n))
258 return __copy_to_user(to, from, n); 258 return __copy_to_user(to, from, n);
259 else 259 else
260 return n; 260 return n;
@@ -278,7 +278,7 @@ __strncpy_from_user(char *dst, const char __user *src, long count)
278static inline long 278static inline long
279strncpy_from_user(char *dst, const char __user *src, long count) 279strncpy_from_user(char *dst, const char __user *src, long count)
280{ 280{
281 if (!__access_ok(src, 1)) 281 if (!access_ok(VERIFY_READ, src, 1))
282 return -EFAULT; 282 return -EFAULT;
283 return __strncpy_from_user(dst, src, count); 283 return __strncpy_from_user(dst, src, count);
284} 284}
@@ -318,7 +318,7 @@ static inline __must_check unsigned long
318clear_user(void __user *to, unsigned long n) 318clear_user(void __user *to, unsigned long n)
319{ 319{
320 might_sleep(); 320 might_sleep();
321 if (!__access_ok(to, n)) 321 if (!access_ok(VERIFY_WRITE, to, n))
322 return n; 322 return n;
323 323
324 return __clear_user(to, n); 324 return __clear_user(to, n);