diff options
Diffstat (limited to 'arch/parisc/include/asm/uaccess.h')
-rw-r--r-- | arch/parisc/include/asm/uaccess.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 0f59fd9ca205..e9150487e20d 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -208,13 +208,13 @@ unsigned long copy_in_user(void __user *dst, const void __user *src, unsigned lo | |||
208 | #define __copy_to_user_inatomic __copy_to_user | 208 | #define __copy_to_user_inatomic __copy_to_user |
209 | #define __copy_from_user_inatomic __copy_from_user | 209 | #define __copy_from_user_inatomic __copy_from_user |
210 | 210 | ||
211 | extern void copy_from_user_overflow(void) | 211 | extern void __compiletime_error("usercopy buffer size is too small") |
212 | #ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS | 212 | __bad_copy_user(void); |
213 | __compiletime_error("copy_from_user() buffer size is not provably correct") | 213 | |
214 | #else | 214 | static inline void copy_user_overflow(int size, unsigned long count) |
215 | __compiletime_warning("copy_from_user() buffer size is not provably correct") | 215 | { |
216 | #endif | 216 | WARN(1, "Buffer overflow detected (%d < %lu)!\n", size, count); |
217 | ; | 217 | } |
218 | 218 | ||
219 | static inline unsigned long __must_check copy_from_user(void *to, | 219 | static inline unsigned long __must_check copy_from_user(void *to, |
220 | const void __user *from, | 220 | const void __user *from, |
@@ -223,10 +223,12 @@ static inline unsigned long __must_check copy_from_user(void *to, | |||
223 | int sz = __compiletime_object_size(to); | 223 | int sz = __compiletime_object_size(to); |
224 | int ret = -EFAULT; | 224 | int ret = -EFAULT; |
225 | 225 | ||
226 | if (likely(sz == -1 || !__builtin_constant_p(n) || sz >= n)) | 226 | if (likely(sz == -1 || sz >= n)) |
227 | ret = __copy_from_user(to, from, n); | 227 | ret = __copy_from_user(to, from, n); |
228 | else | 228 | else if (!__builtin_constant_p(n)) |
229 | copy_from_user_overflow(); | 229 | copy_user_overflow(sz, n); |
230 | else | ||
231 | __bad_copy_user(); | ||
230 | 232 | ||
231 | return ret; | 233 | return ret; |
232 | } | 234 | } |