at v4.13 728 B view raw
1#include <linux/uaccess.h> 2 3/* out-of-line parts */ 4 5#ifndef INLINE_COPY_FROM_USER 6unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n) 7{ 8 unsigned long res = n; 9 might_fault(); 10 if (likely(access_ok(VERIFY_READ, from, n))) { 11 kasan_check_write(to, n); 12 res = raw_copy_from_user(to, from, n); 13 } 14 if (unlikely(res)) 15 memset(to + (n - res), 0, res); 16 return res; 17} 18EXPORT_SYMBOL(_copy_from_user); 19#endif 20 21#ifndef INLINE_COPY_TO_USER 22unsigned long _copy_to_user(void *to, const void __user *from, unsigned long n) 23{ 24 might_fault(); 25 if (likely(access_ok(VERIFY_WRITE, to, n))) { 26 kasan_check_read(from, n); 27 n = raw_copy_to_user(to, from, n); 28 } 29 return n; 30} 31EXPORT_SYMBOL(_copy_to_user); 32#endif