aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-i386/uaccess.h67
1 files changed, 34 insertions, 33 deletions
diff --git a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
index 54d905ebc63d..eef5133b9ce2 100644
--- a/include/asm-i386/uaccess.h
+++ b/include/asm-i386/uaccess.h
@@ -404,20 +404,6 @@ unsigned long __must_check __copy_from_user_ll_nocache_nozero(void *to,
404 * anything, so this is accurate. 404 * anything, so this is accurate.
405 */ 405 */
406 406
407/**
408 * __copy_to_user: - Copy a block of data into user space, with less checking.
409 * @to: Destination address, in user space.
410 * @from: Source address, in kernel space.
411 * @n: Number of bytes to copy.
412 *
413 * Context: User context only. This function may sleep.
414 *
415 * Copy data from kernel space to user space. Caller must check
416 * the specified block with access_ok() before calling this function.
417 *
418 * Returns number of bytes that could not be copied.
419 * On success, this will be zero.
420 */
421static __always_inline unsigned long __must_check 407static __always_inline unsigned long __must_check
422__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n) 408__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
423{ 409{
@@ -439,35 +425,27 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
439 return __copy_to_user_ll(to, from, n); 425 return __copy_to_user_ll(to, from, n);
440} 426}
441 427
442static __always_inline unsigned long __must_check
443__copy_to_user(void __user *to, const void *from, unsigned long n)
444{
445 might_sleep();
446 return __copy_to_user_inatomic(to, from, n);
447}
448
449/** 428/**
450 * __copy_from_user: - Copy a block of data from user space, with less checking. 429 * __copy_to_user: - Copy a block of data into user space, with less checking.
451 * @to: Destination address, in kernel space. 430 * @to: Destination address, in user space.
452 * @from: Source address, in user space. 431 * @from: Source address, in kernel space.
453 * @n: Number of bytes to copy. 432 * @n: Number of bytes to copy.
454 * 433 *
455 * Context: User context only. This function may sleep. 434 * Context: User context only. This function may sleep.
456 * 435 *
457 * Copy data from user space to kernel space. Caller must check 436 * Copy data from kernel space to user space. Caller must check
458 * the specified block with access_ok() before calling this function. 437 * the specified block with access_ok() before calling this function.
459 * 438 *
460 * Returns number of bytes that could not be copied. 439 * Returns number of bytes that could not be copied.
461 * On success, this will be zero. 440 * On success, this will be zero.
462 *
463 * If some data could not be copied, this function will pad the copied
464 * data to the requested size using zero bytes.
465 *
466 * An alternate version - __copy_from_user_inatomic() - may be called from
467 * atomic context and will fail rather than sleep. In this case the
468 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
469 * for explanation of why this is needed.
470 */ 441 */
442static __always_inline unsigned long __must_check
443__copy_to_user(void __user *to, const void *from, unsigned long n)
444{
445 might_sleep();
446 return __copy_to_user_inatomic(to, from, n);
447}
448
471static __always_inline unsigned long 449static __always_inline unsigned long
472__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n) 450__copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
473{ 451{
@@ -493,6 +471,29 @@ __copy_from_user_inatomic(void *to, const void __user *from, unsigned long n)
493 } 471 }
494 return __copy_from_user_ll_nozero(to, from, n); 472 return __copy_from_user_ll_nozero(to, from, n);
495} 473}
474
475/**
476 * __copy_from_user: - Copy a block of data from user space, with less checking.
477 * @to: Destination address, in kernel space.
478 * @from: Source address, in user space.
479 * @n: Number of bytes to copy.
480 *
481 * Context: User context only. This function may sleep.
482 *
483 * Copy data from user space to kernel space. Caller must check
484 * the specified block with access_ok() before calling this function.
485 *
486 * Returns number of bytes that could not be copied.
487 * On success, this will be zero.
488 *
489 * If some data could not be copied, this function will pad the copied
490 * data to the requested size using zero bytes.
491 *
492 * An alternate version - __copy_from_user_inatomic() - may be called from
493 * atomic context and will fail rather than sleep. In this case the
494 * uncopied bytes will *NOT* be padded with zeros. See fs/filemap.h
495 * for explanation of why this is needed.
496 */
496static __always_inline unsigned long 497static __always_inline unsigned long
497__copy_from_user(void *to, const void __user *from, unsigned long n) 498__copy_from_user(void *to, const void __user *from, unsigned long n)
498{ 499{