]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: Do not dereference iov if length is zero
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 6 Sep 2007 13:06:35 +0000 (14:06 +0100)
committerDavid S. Miller <davem@kimchee.(none)>
Tue, 11 Sep 2007 08:29:07 +0000 (10:29 +0200)
When msg_iovlen is zero we shouldn't try to dereference
msg_iov.  Right now the only thing that tries to do so
is skb_copy_and_csum_datagram_iovec.  Since the total
length should also be zero if msg_iovlen is zero, it's
sufficient to check the total length there and simply
return if it's zero.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/datagram.c

index cb056f476126281159f1eed9216a757dbf83dc77..029b93e246b45ea934b1da0cd018425e52965fcb 100644 (file)
@@ -450,6 +450,9 @@ int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb,
        __wsum csum;
        int chunk = skb->len - hlen;
 
+       if (!chunk)
+               return 0;
+
        /* Skip filled elements.
         * Pretty silly, look at memcpy_toiovec, though 8)
         */