diff options
Diffstat (limited to 'include/asm-arm/uaccess.h')
| -rw-r--r-- | include/asm-arm/uaccess.h | 45 |
1 files changed, 13 insertions, 32 deletions
diff --git a/include/asm-arm/uaccess.h b/include/asm-arm/uaccess.h index 064f0f5e8e2b..f909dc75301a 100644 --- a/include/asm-arm/uaccess.h +++ b/include/asm-arm/uaccess.h | |||
| @@ -353,66 +353,47 @@ do { \ | |||
| 353 | : "r" (x), "i" (-EFAULT) \ | 353 | : "r" (x), "i" (-EFAULT) \ |
| 354 | : "cc") | 354 | : "cc") |
| 355 | 355 | ||
| 356 | extern unsigned long __arch_copy_from_user(void *to, const void __user *from, unsigned long n); | 356 | |
| 357 | extern unsigned long __arch_copy_to_user(void __user *to, const void *from, unsigned long n); | 357 | extern unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n); |
| 358 | extern unsigned long __arch_clear_user(void __user *addr, unsigned long n); | 358 | extern unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n); |
| 359 | extern unsigned long __arch_strncpy_from_user(char *to, const char __user *from, unsigned long count); | 359 | extern unsigned long __clear_user(void __user *addr, unsigned long n); |
| 360 | extern unsigned long __arch_strnlen_user(const char __user *s, long n); | 360 | extern unsigned long __strncpy_from_user(char *to, const char __user *from, unsigned long count); |
| 361 | extern unsigned long __strnlen_user(const char __user *s, long n); | ||
| 361 | 362 | ||
| 362 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) | 363 | static inline unsigned long copy_from_user(void *to, const void __user *from, unsigned long n) |
| 363 | { | 364 | { |
| 364 | if (access_ok(VERIFY_READ, from, n)) | 365 | if (access_ok(VERIFY_READ, from, n)) |
| 365 | n = __arch_copy_from_user(to, from, n); | 366 | n = __copy_from_user(to, from, n); |
| 366 | else /* security hole - plug it */ | 367 | else /* security hole - plug it */ |
| 367 | memzero(to, n); | 368 | memzero(to, n); |
| 368 | return n; | 369 | return n; |
| 369 | } | 370 | } |
| 370 | 371 | ||
| 371 | static inline unsigned long __copy_from_user(void *to, const void __user *from, unsigned long n) | ||
| 372 | { | ||
| 373 | return __arch_copy_from_user(to, from, n); | ||
| 374 | } | ||
| 375 | |||
| 376 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) | 372 | static inline unsigned long copy_to_user(void __user *to, const void *from, unsigned long n) |
| 377 | { | 373 | { |
| 378 | if (access_ok(VERIFY_WRITE, to, n)) | 374 | if (access_ok(VERIFY_WRITE, to, n)) |
| 379 | n = __arch_copy_to_user(to, from, n); | 375 | n = __copy_to_user(to, from, n); |
| 380 | return n; | 376 | return n; |
| 381 | } | 377 | } |
| 382 | 378 | ||
| 383 | static inline unsigned long __copy_to_user(void __user *to, const void *from, unsigned long n) | ||
| 384 | { | ||
| 385 | return __arch_copy_to_user(to, from, n); | ||
| 386 | } | ||
| 387 | |||
| 388 | #define __copy_to_user_inatomic __copy_to_user | 379 | #define __copy_to_user_inatomic __copy_to_user |
| 389 | #define __copy_from_user_inatomic __copy_from_user | 380 | #define __copy_from_user_inatomic __copy_from_user |
| 390 | 381 | ||
| 391 | static inline unsigned long clear_user (void __user *to, unsigned long n) | 382 | static inline unsigned long clear_user(void __user *to, unsigned long n) |
| 392 | { | 383 | { |
| 393 | if (access_ok(VERIFY_WRITE, to, n)) | 384 | if (access_ok(VERIFY_WRITE, to, n)) |
| 394 | n = __arch_clear_user(to, n); | 385 | n = __clear_user(to, n); |
| 395 | return n; | 386 | return n; |
| 396 | } | 387 | } |
| 397 | 388 | ||
| 398 | static inline unsigned long __clear_user (void __user *to, unsigned long n) | 389 | static inline long strncpy_from_user(char *dst, const char __user *src, long count) |
| 399 | { | ||
| 400 | return __arch_clear_user(to, n); | ||
| 401 | } | ||
| 402 | |||
| 403 | static inline long strncpy_from_user (char *dst, const char __user *src, long count) | ||
| 404 | { | 390 | { |
| 405 | long res = -EFAULT; | 391 | long res = -EFAULT; |
| 406 | if (access_ok(VERIFY_READ, src, 1)) | 392 | if (access_ok(VERIFY_READ, src, 1)) |
| 407 | res = __arch_strncpy_from_user(dst, src, count); | 393 | res = __strncpy_from_user(dst, src, count); |
| 408 | return res; | 394 | return res; |
| 409 | } | 395 | } |
| 410 | 396 | ||
| 411 | static inline long __strncpy_from_user (char *dst, const char __user *src, long count) | ||
| 412 | { | ||
| 413 | return __arch_strncpy_from_user(dst, src, count); | ||
| 414 | } | ||
| 415 | |||
| 416 | #define strlen_user(s) strnlen_user(s, ~0UL >> 1) | 397 | #define strlen_user(s) strnlen_user(s, ~0UL >> 1) |
| 417 | 398 | ||
| 418 | static inline long strnlen_user(const char __user *s, long n) | 399 | static inline long strnlen_user(const char __user *s, long n) |
| @@ -420,7 +401,7 @@ static inline long strnlen_user(const char __user *s, long n) | |||
| 420 | unsigned long res = 0; | 401 | unsigned long res = 0; |
| 421 | 402 | ||
| 422 | if (__addr_ok(s)) | 403 | if (__addr_ok(s)) |
| 423 | res = __arch_strnlen_user(s, n); | 404 | res = __strnlen_user(s, n); |
| 424 | 405 | ||
| 425 | return res; | 406 | return res; |
| 426 | } | 407 | } |
