net: Fix memcpy_toiovecend() to use the right offset
authorSridhar Samudrala <sri@us.ibm.com>
Fri, 5 Jun 2009 09:35:44 +0000 (09:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jun 2009 07:25:39 +0000 (00:25 -0700)
Increment the iovec base by the offset passed in for the initial
copy_to_user() in memcpy_to_iovecend().

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/iovec.c

index 40a76ce19d9fddfb90d2b21f282135e4d1bef239..16ad45d4882b56a2c531a0a944bc31c690ff5a4b 100644 (file)
@@ -112,9 +112,9 @@ int memcpy_toiovecend(const struct iovec *iov, unsigned char *kdata,
                        continue;
                }
                copy = min_t(unsigned int, iov->iov_len - offset, len);
-               offset = 0;
-               if (copy_to_user(iov->iov_base, kdata, copy))
+               if (copy_to_user(iov->iov_base + offset, kdata, copy))
                        return -EFAULT;
+               offset = 0;
                kdata += copy;
                len -= copy;
        }