crypto: sha512-avx2 - Fix RBP usage
[linux/fpc-iii.git] / lib / usercopy.c
blobf5d9f08ee032f36a19cafa8a2d83f648d326fd97
1 #include <linux/uaccess.h>
3 /* out-of-line parts */
5 #ifndef INLINE_COPY_FROM_USER
6 unsigned long _copy_from_user(void *to, const void __user *from, unsigned long n)
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);
14 if (unlikely(res))
15 memset(to + (n - res), 0, res);
16 return res;
18 EXPORT_SYMBOL(_copy_from_user);
19 #endif
21 #ifndef INLINE_COPY_TO_USER
22 unsigned long _copy_to_user(void *to, const void __user *from, unsigned long n)
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);
29 return n;
31 EXPORT_SYMBOL(_copy_to_user);
32 #endif