summaryrefslogtreecommitdiffstats
path: root/drivers/net/macvtap.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-11-01 22:09:04 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-12-05 14:33:36 -0500
commitcbbd26b8b1a6af9c02e2b6523e12bd50cc765059 (patch)
tree6d1b258c99e83f320cf3611bdc927121df7e9b03 /drivers/net/macvtap.c
parente5517c2a5a49ed5e99047008629f1cd60246ea0e (diff)
[iov_iter] new primitives - copy_from_iter_full() and friends
copy_from_iter_full(), copy_from_iter_full_nocache() and csum_and_copy_from_iter_full() - counterparts of copy_from_iter() et.al., advancing iterator only in case of successful full copy and returning whether it had been successful or not. Convert some obvious users. *NOTE* - do not blindly assume that something is a good candidate for those unless you are sure that not advancing iov_iter in failure case is the right thing in this case. Anything that does short read/short write kind of stuff (or is in a loop, etc.) is unlikely to be a good one. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/net/macvtap.c')
-rw-r--r--drivers/net/macvtap.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 070e3290aa6e..19d81ca3fb49 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -673,7 +673,6 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
673 int depth; 673 int depth;
674 bool zerocopy = false; 674 bool zerocopy = false;
675 size_t linear; 675 size_t linear;
676 ssize_t n;
677 676
678 if (q->flags & IFF_VNET_HDR) { 677 if (q->flags & IFF_VNET_HDR) {
679 vnet_hdr_len = q->vnet_hdr_sz; 678 vnet_hdr_len = q->vnet_hdr_sz;
@@ -684,8 +683,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
684 len -= vnet_hdr_len; 683 len -= vnet_hdr_len;
685 684
686 err = -EFAULT; 685 err = -EFAULT;
687 n = copy_from_iter(&vnet_hdr, sizeof(vnet_hdr), from); 686 if (!copy_from_iter_full(&vnet_hdr, sizeof(vnet_hdr), from))
688 if (n != sizeof(vnet_hdr))
689 goto err; 687 goto err;
690 iov_iter_advance(from, vnet_hdr_len - sizeof(vnet_hdr)); 688 iov_iter_advance(from, vnet_hdr_len - sizeof(vnet_hdr));
691 if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && 689 if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&