hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/xtensa/include/asm/checksum.h
....@@ -13,7 +13,7 @@
1313
1414 #include <linux/in6.h>
1515 #include <linux/uaccess.h>
16
-#include <variant/core.h>
16
+#include <asm/core.h>
1717
1818 /*
1919 * computes the checksum of a memory block at buff, length len,
....@@ -37,29 +37,27 @@
3737 * better 64-bit) boundary
3838 */
3939
40
-asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst,
41
- int len, __wsum sum,
42
- int *src_err_ptr, int *dst_err_ptr);
40
+asmlinkage __wsum csum_partial_copy_generic(const void *src, void *dst, int len);
4341
42
+#define _HAVE_ARCH_CSUM_AND_COPY
4443 /*
4544 * Note: when you get a NULL pointer exception here this means someone
4645 * passed in an incorrect kernel address to one of these functions.
47
- *
48
- * If you use these functions directly please don't forget the access_ok().
4946 */
5047 static inline
51
-__wsum csum_partial_copy_nocheck(const void *src, void *dst,
52
- int len, __wsum sum)
48
+__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len)
5349 {
54
- return csum_partial_copy_generic(src, dst, len, sum, NULL, NULL);
50
+ return csum_partial_copy_generic(src, dst, len);
5551 }
5652
53
+#define _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
5754 static inline
58
-__wsum csum_partial_copy_from_user(const void __user *src, void *dst,
59
- int len, __wsum sum, int *err_ptr)
55
+__wsum csum_and_copy_from_user(const void __user *src, void *dst,
56
+ int len)
6057 {
61
- return csum_partial_copy_generic((__force const void *)src, dst,
62
- len, sum, err_ptr, NULL);
58
+ if (!access_ok(src, len))
59
+ return 0;
60
+ return csum_partial_copy_generic((__force const void *)src, dst, len);
6361 }
6462
6563 /*
....@@ -240,15 +238,10 @@
240238 */
241239 #define HAVE_CSUM_COPY_USER
242240 static __inline__ __wsum csum_and_copy_to_user(const void *src,
243
- void __user *dst, int len,
244
- __wsum sum, int *err_ptr)
241
+ void __user *dst, int len)
245242 {
246
- if (access_ok(VERIFY_WRITE, dst, len))
247
- return csum_partial_copy_generic(src,dst,len,sum,NULL,err_ptr);
248
-
249
- if (len)
250
- *err_ptr = -EFAULT;
251
-
252
- return (__force __wsum)-1; /* invalid checksum */
243
+ if (!access_ok(dst, len))
244
+ return 0;
245
+ return csum_partial_copy_generic(src, (__force void *)dst, len);
253246 }
254247 #endif