diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-10 18:53:30 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-09-15 19:51:57 -0400 |
commit | b065444286bed7ec49ee81c593a46f3031fbfc83 (patch) | |
tree | bd6fab6ac4cfa90db4af2179efcd50668fab76ba /arch/blackfin/include/asm | |
parent | 4855bd255f9fb429d296dc3c620f1b563d20353e (diff) |
blackfin: no access_ok() for __copy_{to,from}_user()
callers have checked that already
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/blackfin/include/asm')
-rw-r--r-- | arch/blackfin/include/asm/uaccess.h | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h index 0a2a70096d8b..0eff88aa6d6a 100644 --- a/arch/blackfin/include/asm/uaccess.h +++ b/arch/blackfin/include/asm/uaccess.h | |||
@@ -163,18 +163,29 @@ static inline int bad_user_access_length(void) | |||
163 | : "a" (__ptr(ptr))); \ | 163 | : "a" (__ptr(ptr))); \ |
164 | }) | 164 | }) |
165 | 165 | ||
166 | #define __copy_from_user(to, from, n) copy_from_user(to, from, n) | ||
167 | #define __copy_to_user(to, from, n) copy_to_user(to, from, n) | ||
168 | #define __copy_to_user_inatomic __copy_to_user | 166 | #define __copy_to_user_inatomic __copy_to_user |
169 | #define __copy_from_user_inatomic __copy_from_user | 167 | #define __copy_from_user_inatomic __copy_from_user |
170 | 168 | ||
171 | static inline unsigned long __must_check | 169 | static inline unsigned long __must_check |
170 | __copy_from_user(void *to, const void __user *from, unsigned long n) | ||
171 | { | ||
172 | memcpy(to, (const void __force *)from, n); | ||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | static inline unsigned long __must_check | ||
177 | __copy_to_user(void __user *to, const void *from, unsigned long n) | ||
178 | { | ||
179 | memcpy((void __force *)to, from, n); | ||
180 | SSYNC(); | ||
181 | return 0; | ||
182 | } | ||
183 | |||
184 | static inline unsigned long __must_check | ||
172 | copy_from_user(void *to, const void __user *from, unsigned long n) | 185 | copy_from_user(void *to, const void __user *from, unsigned long n) |
173 | { | 186 | { |
174 | if (likely(access_ok(VERIFY_READ, from, n))) { | 187 | if (likely(access_ok(VERIFY_READ, from, n))) |
175 | memcpy(to, (const void __force *)from, n); | 188 | return __copy_from_user(to, from, n); |
176 | return 0; | ||
177 | } | ||
178 | memset(to, 0, n); | 189 | memset(to, 0, n); |
179 | return n; | 190 | return n; |
180 | } | 191 | } |
@@ -182,12 +193,9 @@ copy_from_user(void *to, const void __user *from, unsigned long n) | |||
182 | static inline unsigned long __must_check | 193 | static inline unsigned long __must_check |
183 | copy_to_user(void __user *to, const void *from, unsigned long n) | 194 | copy_to_user(void __user *to, const void *from, unsigned long n) |
184 | { | 195 | { |
185 | if (access_ok(VERIFY_WRITE, to, n)) | 196 | if (likely(access_ok(VERIFY_WRITE, to, n))) |
186 | memcpy((void __force *)to, from, n); | 197 | return __copy_to_user(to, from, n); |
187 | else | 198 | return n; |
188 | return n; | ||
189 | SSYNC(); | ||
190 | return 0; | ||
191 | } | 199 | } |
192 | 200 | ||
193 | /* | 201 | /* |