Skip to content

Commit

Permalink
net: Fix memcpy_toiovecend() to use the right offset
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sridhar Samudrala authored and David S. Miller committed Jun 8, 2009
1 parent d2d27bf commit 2faef52
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/core/iovec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2faef52

Please sign in to comment.