Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <sri@us.ibm.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sridhar Samudrala and committed by
David S. Miller
2faef52b d2d27bfd

+2 -2
+2 -2
net/core/iovec.c
··· 112 112 continue; 113 113 } 114 114 copy = min_t(unsigned int, iov->iov_len - offset, len); 115 - offset = 0; 116 - if (copy_to_user(iov->iov_base, kdata, copy)) 115 + if (copy_to_user(iov->iov_base + offset, kdata, copy)) 117 116 return -EFAULT; 117 + offset = 0; 118 118 kdata += copy; 119 119 len -= copy; 120 120 }