diff options
Diffstat (limited to 'arch/x86_64/lib')
-rw-r--r-- | arch/x86_64/lib/usercopy.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c index db8abba1ad81..9bc2c295818e 100644 --- a/arch/x86_64/lib/usercopy.c +++ b/arch/x86_64/lib/usercopy.c | |||
@@ -109,14 +109,11 @@ unsigned long clear_user(void __user *to, unsigned long n) | |||
109 | * Return 0 on exception, a value greater than N if too long | 109 | * Return 0 on exception, a value greater than N if too long |
110 | */ | 110 | */ |
111 | 111 | ||
112 | long strnlen_user(const char __user *s, long n) | 112 | long __strnlen_user(const char __user *s, long n) |
113 | { | 113 | { |
114 | long res = 0; | 114 | long res = 0; |
115 | char c; | 115 | char c; |
116 | 116 | ||
117 | if (!access_ok(VERIFY_READ, s, n)) | ||
118 | return 0; | ||
119 | |||
120 | while (1) { | 117 | while (1) { |
121 | if (res>n) | 118 | if (res>n) |
122 | return n+1; | 119 | return n+1; |
@@ -129,6 +126,13 @@ long strnlen_user(const char __user *s, long n) | |||
129 | } | 126 | } |
130 | } | 127 | } |
131 | 128 | ||
129 | long strnlen_user(const char __user *s, long n) | ||
130 | { | ||
131 | if (!access_ok(VERIFY_READ, s, n)) | ||
132 | return 0; | ||
133 | return __strnlen_user(s, n); | ||
134 | } | ||
135 | |||
132 | long strlen_user(const char __user *s) | 136 | long strlen_user(const char __user *s) |
133 | { | 137 | { |
134 | long res = 0; | 138 | long res = 0; |