|
@@ -21,10 +21,27 @@ copy_user_generic(void *to, const void *from, unsigned len);
|
|
__must_check unsigned long
|
|
__must_check unsigned long
|
|
copy_to_user(void __user *to, const void *from, unsigned len);
|
|
copy_to_user(void __user *to, const void *from, unsigned len);
|
|
__must_check unsigned long
|
|
__must_check unsigned long
|
|
-copy_from_user(void *to, const void __user *from, unsigned len);
|
|
|
|
|
|
+_copy_from_user(void *to, const void __user *from, unsigned len);
|
|
__must_check unsigned long
|
|
__must_check unsigned long
|
|
copy_in_user(void __user *to, const void __user *from, unsigned len);
|
|
copy_in_user(void __user *to, const void __user *from, unsigned len);
|
|
|
|
|
|
|
|
+static inline unsigned long __must_check copy_from_user(void *to,
|
|
|
|
+ const void __user *from,
|
|
|
|
+ unsigned long n)
|
|
|
|
+{
|
|
|
|
+ int sz = __compiletime_object_size(to);
|
|
|
|
+ int ret = -EFAULT;
|
|
|
|
+
|
|
|
|
+ if (likely(sz == -1 || sz >= n))
|
|
|
|
+ ret = _copy_from_user(to, from, n);
|
|
|
|
+#ifdef CONFIG_DEBUG_VM
|
|
|
|
+ else
|
|
|
|
+ WARN(1, "Buffer overflow detected!\n");
|
|
|
|
+#endif
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
static __always_inline __must_check
|
|
static __always_inline __must_check
|
|
int __copy_from_user(void *dst, const void __user *src, unsigned size)
|
|
int __copy_from_user(void *dst, const void __user *src, unsigned size)
|
|
{
|
|
{
|