From: Sridhar Samudrala Date: Fri, 5 Jun 2009 09:35:44 +0000 (+0000) Subject: net: Fix memcpy_toiovecend() to use the right offset X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=2faef52b72958b8b1c08e927b9b0691c314cf6f4;p=openwrt%2Fstaging%2Fblogic.git net: Fix memcpy_toiovecend() to use the right offset Increment the iovec base by the offset passed in for the initial copy_to_user() in memcpy_to_iovecend(). Signed-off-by: Sridhar Samudrala Acked-by: Michael S. Tsirkin Signed-off-by: David S. Miller --- diff --git a/net/core/iovec.c b/net/core/iovec.c index 40a76ce19d9f..16ad45d4882b 100644 --- a/net/core/iovec.c +++ b/net/core/iovec.c @@ -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; }