patch-2.3.38 linux/include/net/checksum.h

Next file: linux/include/net/dsfield.h
Previous file: linux/include/linux/tcp.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.37/linux/include/net/checksum.h linux/include/net/checksum.h
@@ -107,4 +107,22 @@
 }
 #endif
 
+#ifndef HAVE_CSUM_COPY_USER
+static __inline__ unsigned int csum_and_copy_to_user
+(const char *src, char *dst, int len, unsigned int sum, int *err_ptr)
+{
+	sum = csum_partial(src, len, sum);
+
+	if (access_ok(VERIFY_WRITE, dst, len)) {
+		if (copy_to_user(dst, src, len) == 0)
+			return sum;
+	}
+	if (len)
+		*err_ptr = -EFAULT;
+
+	return -1; /* invalid checksum */
+}
+#endif
+
+
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)