|
@@ -496,7 +496,10 @@ arm_copy_from_user(void *to, const void __user *from, unsigned long n);
|
|
|
static inline unsigned long __must_check
|
|
|
__copy_from_user(void *to, const void __user *from, unsigned long n)
|
|
|
{
|
|
|
- unsigned int __ua_flags = uaccess_save_and_enable();
|
|
|
+ unsigned int __ua_flags;
|
|
|
+
|
|
|
+ check_object_size(to, n, false);
|
|
|
+ __ua_flags = uaccess_save_and_enable();
|
|
|
n = arm_copy_from_user(to, from, n);
|
|
|
uaccess_restore(__ua_flags);
|
|
|
return n;
|
|
@@ -511,11 +514,15 @@ static inline unsigned long __must_check
|
|
|
__copy_to_user(void __user *to, const void *from, unsigned long n)
|
|
|
{
|
|
|
#ifndef CONFIG_UACCESS_WITH_MEMCPY
|
|
|
- unsigned int __ua_flags = uaccess_save_and_enable();
|
|
|
+ unsigned int __ua_flags;
|
|
|
+
|
|
|
+ check_object_size(from, n, true);
|
|
|
+ __ua_flags = uaccess_save_and_enable();
|
|
|
n = arm_copy_to_user(to, from, n);
|
|
|
uaccess_restore(__ua_flags);
|
|
|
return n;
|
|
|
#else
|
|
|
+ check_object_size(from, n, true);
|
|
|
return arm_copy_to_user(to, from, n);
|
|
|
#endif
|
|
|
}
|