1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 */
4 #include <linux/module.h>
5 #include <net/checksum.h>
6
7 #include <asm/byteorder.h>
8
9 /*
10 * copy from fs while checksumming, otherwise like csum_partial
11 */
12 __wsum
csum_partial_copy_from_user(const void __user * src,void * dst,int len,__wsum sum,int * csum_err)13 csum_partial_copy_from_user(const void __user *src, void *dst, int len,
14 __wsum sum, int *csum_err)
15 {
16 int missing;
17
18 missing = __copy_from_user(dst, src, len);
19 if (missing) {
20 memset(dst + len - missing, 0, missing);
21 *csum_err = -EFAULT;
22 } else
23 *csum_err = 0;
24
25 return csum_partial(dst, len, sum);
26 }
27 EXPORT_SYMBOL(csum_partial_copy_from_user);
28
29 /* These are from csum_64plus.S */
30 EXPORT_SYMBOL(csum_partial);
31 EXPORT_SYMBOL(csum_partial_copy);
32 EXPORT_SYMBOL(ip_compute_csum);
33 EXPORT_SYMBOL(ip_fast_csum);
34