patch-2.3.41 linux/net/core/iovec.c

Next file: linux/net/core/skbuff.c
Previous file: linux/net/core/datagram.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.40/linux/net/core/iovec.c linux/net/core/iovec.c
@@ -104,6 +104,11 @@
 
 /* Copy and checkum skb to user iovec. Caller _must_ check that
    skb will fit to this iovec.
+
+   Returns: 0       - success.
+            -EINVAL - checksum failure.
+	    -EFAULT - fault during copy. Beware, in this case iovec can be
+	              modified!
  */
 
 int copy_and_csum_toiovec(struct iovec *iov, struct sk_buff *skb, int hlen)
@@ -111,7 +116,7 @@
 	unsigned int csum;
 	int chunk = skb->len - hlen;
 
-	/* Skip filled elements. Pretty silly, look at mecpy_toiove, though 8) */
+	/* Skip filled elements. Pretty silly, look at memcpy_toiovec, though 8) */
 	while (iov->iov_len == 0)
 		iov++;
 
@@ -119,7 +124,7 @@
 		if ((unsigned short)csum_fold(csum_partial(skb->h.raw, chunk+hlen, skb->csum)))
 			goto csum_error;
 		if (memcpy_toiovec(iov, skb->h.raw + hlen, chunk))
-			goto csum_error;
+			goto fault;
 	} else {
 		int err = 0;
 		csum = csum_partial(skb->h.raw, hlen, skb->csum);
@@ -133,6 +138,9 @@
 	return 0;
 
 csum_error:
+	return -EINVAL;
+
+fault:
 	return -EFAULT;
 }
 

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