summaryrefslogtreecommitdiffstats
path: root/include/net/checksum.h
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-11-04 18:14:52 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-11-04 18:14:52 +0100
commit01be83eea08d6d9f9209843e2e084505fba4053f (patch)
tree95b456e1ac40399fd5f55b57ae0936643bea1836 /include/net/checksum.h
parent45ff510517f3b1354a3d9c273ad5e5e8d08312cb (diff)
parent9d820f68b2bdba5b2e7bf135123c3f57c5051d05 (diff)
downloadlinux-01be83eea08d6d9f9209843e2e084505fba4053f.tar.bz2
Merge branch 'core/urgent' into core/entry
Pick up the entry fix before further modifications.
Diffstat (limited to 'include/net/checksum.h')
-rw-r--r--include/net/checksum.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 46754ba9d7b7..0d05b9e8690b 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -24,26 +24,32 @@
#ifndef _HAVE_ARCH_COPY_AND_CSUM_FROM_USER
static inline
__wsum csum_and_copy_from_user (const void __user *src, void *dst,
- int len, __wsum sum, int *err_ptr)
+ int len)
{
if (copy_from_user(dst, src, len))
- *err_ptr = -EFAULT;
- return csum_partial(dst, len, sum);
+ return 0;
+ return csum_partial(dst, len, ~0U);
}
#endif
#ifndef HAVE_CSUM_COPY_USER
static __inline__ __wsum csum_and_copy_to_user
-(const void *src, void __user *dst, int len, __wsum sum, int *err_ptr)
+(const void *src, void __user *dst, int len)
{
- sum = csum_partial(src, len, sum);
+ __wsum sum = csum_partial(src, len, ~0U);
if (copy_to_user(dst, src, len) == 0)
return sum;
- if (len)
- *err_ptr = -EFAULT;
+ return 0;
+}
+#endif
- return (__force __wsum)-1; /* invalid checksum */
+#ifndef _HAVE_ARCH_CSUM_AND_COPY
+static inline __wsum
+csum_partial_copy_nocheck(const void *src, void *dst, int len)
+{
+ memcpy(dst, src, len);
+ return csum_partial(dst, len, 0);
}
#endif