aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/uaccess.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/uaccess.h')
-rw-r--r--arch/mips/include/asm/uaccess.h37
1 files changed, 21 insertions, 16 deletions
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index 5c0876073f13..8de858f5449f 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -245,6 +245,7 @@ do { \
245 int __gu_err = -EFAULT; \ 245 int __gu_err = -EFAULT; \
246 const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); \ 246 const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); \
247 \ 247 \
248 might_fault(); \
248 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \ 249 if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) \
249 __get_user_common((x), size, __gu_ptr); \ 250 __get_user_common((x), size, __gu_ptr); \
250 \ 251 \
@@ -334,6 +335,7 @@ do { \
334 __typeof__(*(ptr)) __pu_val = (x); \ 335 __typeof__(*(ptr)) __pu_val = (x); \
335 int __pu_err = -EFAULT; \ 336 int __pu_err = -EFAULT; \
336 \ 337 \
338 might_fault(); \
337 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \ 339 if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \
338 switch (size) { \ 340 switch (size) { \
339 case 1: __put_user_asm("sb", __pu_addr); break; \ 341 case 1: __put_user_asm("sb", __pu_addr); break; \
@@ -708,10 +710,10 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
708 const void *__cu_from; \ 710 const void *__cu_from; \
709 long __cu_len; \ 711 long __cu_len; \
710 \ 712 \
711 might_sleep(); \
712 __cu_to = (to); \ 713 __cu_to = (to); \
713 __cu_from = (from); \ 714 __cu_from = (from); \
714 __cu_len = (n); \ 715 __cu_len = (n); \
716 might_fault(); \
715 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \ 717 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, __cu_len); \
716 __cu_len; \ 718 __cu_len; \
717}) 719})
@@ -764,13 +766,14 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
764 const void *__cu_from; \ 766 const void *__cu_from; \
765 long __cu_len; \ 767 long __cu_len; \
766 \ 768 \
767 might_sleep(); \
768 __cu_to = (to); \ 769 __cu_to = (to); \
769 __cu_from = (from); \ 770 __cu_from = (from); \
770 __cu_len = (n); \ 771 __cu_len = (n); \
771 if (access_ok(VERIFY_WRITE, __cu_to, __cu_len)) \ 772 if (access_ok(VERIFY_WRITE, __cu_to, __cu_len)) { \
773 might_fault(); \
772 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, \ 774 __cu_len = __invoke_copy_to_user(__cu_to, __cu_from, \
773 __cu_len); \ 775 __cu_len); \
776 } \
774 __cu_len; \ 777 __cu_len; \
775}) 778})
776 779
@@ -843,10 +846,10 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
843 const void __user *__cu_from; \ 846 const void __user *__cu_from; \
844 long __cu_len; \ 847 long __cu_len; \
845 \ 848 \
846 might_sleep(); \
847 __cu_to = (to); \ 849 __cu_to = (to); \
848 __cu_from = (from); \ 850 __cu_from = (from); \
849 __cu_len = (n); \ 851 __cu_len = (n); \
852 might_fault(); \
850 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \ 853 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
851 __cu_len); \ 854 __cu_len); \
852 __cu_len; \ 855 __cu_len; \
@@ -874,13 +877,14 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
874 const void __user *__cu_from; \ 877 const void __user *__cu_from; \
875 long __cu_len; \ 878 long __cu_len; \
876 \ 879 \
877 might_sleep(); \
878 __cu_to = (to); \ 880 __cu_to = (to); \
879 __cu_from = (from); \ 881 __cu_from = (from); \
880 __cu_len = (n); \ 882 __cu_len = (n); \
881 if (access_ok(VERIFY_READ, __cu_from, __cu_len)) \ 883 if (access_ok(VERIFY_READ, __cu_from, __cu_len)) { \
884 might_fault(); \
882 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \ 885 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
883 __cu_len); \ 886 __cu_len); \
887 } \
884 __cu_len; \ 888 __cu_len; \
885}) 889})
886 890
@@ -890,10 +894,10 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
890 const void __user *__cu_from; \ 894 const void __user *__cu_from; \
891 long __cu_len; \ 895 long __cu_len; \
892 \ 896 \
893 might_sleep(); \
894 __cu_to = (to); \ 897 __cu_to = (to); \
895 __cu_from = (from); \ 898 __cu_from = (from); \
896 __cu_len = (n); \ 899 __cu_len = (n); \
900 might_fault(); \
897 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \ 901 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
898 __cu_len); \ 902 __cu_len); \
899 __cu_len; \ 903 __cu_len; \
@@ -905,14 +909,15 @@ extern size_t __copy_user_inatomic(void *__to, const void *__from, size_t __n);
905 const void __user *__cu_from; \ 909 const void __user *__cu_from; \
906 long __cu_len; \ 910 long __cu_len; \
907 \ 911 \
908 might_sleep(); \
909 __cu_to = (to); \ 912 __cu_to = (to); \
910 __cu_from = (from); \ 913 __cu_from = (from); \
911 __cu_len = (n); \ 914 __cu_len = (n); \
912 if (likely(access_ok(VERIFY_READ, __cu_from, __cu_len) && \ 915 if (likely(access_ok(VERIFY_READ, __cu_from, __cu_len) && \
913 access_ok(VERIFY_WRITE, __cu_to, __cu_len))) \ 916 access_ok(VERIFY_WRITE, __cu_to, __cu_len))) { \
917 might_fault(); \
914 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \ 918 __cu_len = __invoke_copy_from_user(__cu_to, __cu_from, \
915 __cu_len); \ 919 __cu_len); \
920 } \
916 __cu_len; \ 921 __cu_len; \
917}) 922})
918 923
@@ -932,7 +937,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
932{ 937{
933 __kernel_size_t res; 938 __kernel_size_t res;
934 939
935 might_sleep(); 940 might_fault();
936 __asm__ __volatile__( 941 __asm__ __volatile__(
937 "move\t$4, %1\n\t" 942 "move\t$4, %1\n\t"
938 "move\t$5, $0\n\t" 943 "move\t$5, $0\n\t"
@@ -981,7 +986,7 @@ __strncpy_from_user(char *__to, const char __user *__from, long __len)
981{ 986{
982 long res; 987 long res;
983 988
984 might_sleep(); 989 might_fault();
985 __asm__ __volatile__( 990 __asm__ __volatile__(
986 "move\t$4, %1\n\t" 991 "move\t$4, %1\n\t"
987 "move\t$5, %2\n\t" 992 "move\t$5, %2\n\t"
@@ -1018,7 +1023,7 @@ strncpy_from_user(char *__to, const char __user *__from, long __len)
1018{ 1023{
1019 long res; 1024 long res;
1020 1025
1021 might_sleep(); 1026 might_fault();
1022 __asm__ __volatile__( 1027 __asm__ __volatile__(
1023 "move\t$4, %1\n\t" 1028 "move\t$4, %1\n\t"
1024 "move\t$5, %2\n\t" 1029 "move\t$5, %2\n\t"
@@ -1037,7 +1042,7 @@ static inline long __strlen_user(const char __user *s)
1037{ 1042{
1038 long res; 1043 long res;
1039 1044
1040 might_sleep(); 1045 might_fault();
1041 __asm__ __volatile__( 1046 __asm__ __volatile__(
1042 "move\t$4, %1\n\t" 1047 "move\t$4, %1\n\t"
1043 __MODULE_JAL(__strlen_user_nocheck_asm) 1048 __MODULE_JAL(__strlen_user_nocheck_asm)
@@ -1067,7 +1072,7 @@ static inline long strlen_user(const char __user *s)
1067{ 1072{
1068 long res; 1073 long res;
1069 1074
1070 might_sleep(); 1075 might_fault();
1071 __asm__ __volatile__( 1076 __asm__ __volatile__(
1072 "move\t$4, %1\n\t" 1077 "move\t$4, %1\n\t"
1073 __MODULE_JAL(__strlen_user_asm) 1078 __MODULE_JAL(__strlen_user_asm)
@@ -1084,7 +1089,7 @@ static inline long __strnlen_user(const char __user *s, long n)
1084{ 1089{
1085 long res; 1090 long res;
1086 1091
1087 might_sleep(); 1092 might_fault();
1088 __asm__ __volatile__( 1093 __asm__ __volatile__(
1089 "move\t$4, %1\n\t" 1094 "move\t$4, %1\n\t"
1090 "move\t$5, %2\n\t" 1095 "move\t$5, %2\n\t"
@@ -1115,7 +1120,7 @@ static inline long strnlen_user(const char __user *s, long n)
1115{ 1120{
1116 long res; 1121 long res;
1117 1122
1118 might_sleep(); 1123 might_fault();
1119 __asm__ __volatile__( 1124 __asm__ __volatile__(
1120 "move\t$4, %1\n\t" 1125 "move\t$4, %1\n\t"
1121 "move\t$5, %2\n\t" 1126 "move\t$5, %2\n\t"