patch-2.1.28 linux/arch/alpha/lib/csum_partial_copy.c

Next file: linux/arch/i386/defconfig
Previous file: linux/arch/alpha/kernel/osf_sys.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.27/linux/arch/alpha/lib/csum_partial_copy.c linux/arch/alpha/lib/csum_partial_copy.c
@@ -304,20 +304,14 @@
 	return checksum;
 }
 
-unsigned int
-csum_partial_copy_from_user(int *errp, char *src, char *dst,
-			    int len, unsigned int sum)
+static unsigned int
+do_csum_partial_copy_from_user(char *src, char *dst, int len,
+			       unsigned int sum, int *errp)
 {
 	unsigned long checksum = (unsigned) sum;
 	unsigned long soff = 7 & (unsigned long) src;
 	unsigned long doff = 7 & (unsigned long) dst;
 
-	if (!access_ok(src, len, VERIFY_READ)) {
-		*errp = -EFAULT;
-		memset(dst, 0, len);
-		return checksum;
-	}
-
 	if (len) {
 		if (!doff) {
 			if (!soff)
@@ -358,12 +352,25 @@
 }
 
 unsigned int
+csum_partial_copy_from_user(char *src, char *dst, int len,
+			    unsigned int sum, int *errp)
+{
+	if (!access_ok(src, len, VERIFY_READ)) {
+		*errp = -EFAULT;
+		memset(dst, 0, len);
+		return sum;
+	}
+
+	return do_csum_partial_copy_from_user(src, dst, len, sum, errp);
+}
+
+unsigned int
 csum_partial_copy (const char *src, char *dst, int len, unsigned int sum)
 {
 	unsigned int ret;
 	int error = 0;
 
-	ret = csum_partial_copy_from_user(&error, src, dst, len, sum);
+	ret = do_csum_partial_copy_from_user(src, dst, len, sum, &error);
 	if (error)
 		printk("csum_partial_copy_old(): tell mingo to convert me!\n");
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov