patch-2.4.8 linux/include/asm-s390x/checksum.h

Next file: linux/include/asm-s390x/current.h
Previous file: linux/include/asm-s390x/chandev.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.7/linux/include/asm-s390x/checksum.h linux/include/asm-s390x/checksum.h
@@ -67,18 +67,24 @@
  *
  * here even more important to align src and dst on a 32-bit (or even
  * better 64-bit) boundary
+ *
+ * Copy from userspace and compute checksum.  If we catch an exception
+ * then zero the rest of the buffer.
  */
-
 extern inline unsigned int 
-csum_partial_copy_from_user(const char *src, char *dst,
-                            int len, unsigned int sum, int *errp)
+csum_partial_copy_from_user (const char *src, char *dst,
+                                          int len, unsigned int sum,
+                                          int *err_ptr)
 {
-	if (copy_from_user(dst, src, len)) {
-		*errp = -EFAULT;
-		memset(dst, 0, len);
-		return sum;
-        }
-        return csum_partial_inline(dst, len, sum);
+	int missing;
+
+	missing = copy_from_user(dst, src, len);
+	if (missing) {
+		memset(dst + len - missing, 0, missing);
+		*err_ptr = -EFAULT;
+	}
+		
+	return csum_partial(dst, len, sum);
 }
 
 extern inline unsigned int

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