Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 149809
b: refs/heads/master
c: 43b39dc
h: refs/heads/master
i:
  149807: 2d3b3b8
v: v3
  • Loading branch information
Michael S. Tsirkin authored and David S. Miller committed Apr 21, 2009
1 parent 4ad2e93 commit 649af92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0a1ec07a67bd8b0033dace237249654d015efa21
refs/heads/master: 43b39dcdbdf823a1c0ac1f2aa2d76bd2f210adc8
11 changes: 6 additions & 5 deletions trunk/drivers/net/tun.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
/* Put packet to the user space buffer */
static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
struct sk_buff *skb,
struct iovec *iv, int len)
const struct iovec *iv, int len)
{
struct tun_pi pi = { 0, skb->protocol };
ssize_t total = 0;
Expand All @@ -697,7 +697,7 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
pi.flags |= TUN_PKT_STRIP;
}

if (memcpy_toiovec(iv, (void *) &pi, sizeof(pi)))
if (memcpy_toiovecend(iv, (void *) &pi, 0, sizeof(pi)))
return -EFAULT;
total += sizeof(pi);
}
Expand Down Expand Up @@ -730,14 +730,15 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
gso.csum_offset = skb->csum_offset;
} /* else everything is zero */

if (unlikely(memcpy_toiovec(iv, (void *)&gso, sizeof(gso))))
if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total,
sizeof(gso))))
return -EFAULT;
total += sizeof(gso);
}

len = min_t(int, skb->len, len);

skb_copy_datagram_iovec(skb, 0, iv, len);
skb_copy_datagram_const_iovec(skb, 0, iv, total, len);
total += len;

tun->dev->stats.tx_packets++;
Expand Down Expand Up @@ -792,7 +793,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
}
netif_wake_queue(tun->dev);

ret = tun_put_user(tun, skb, (struct iovec *) iv, len);
ret = tun_put_user(tun, skb, iv, len);
kfree_skb(skb);
break;
}
Expand Down

0 comments on commit 649af92

Please sign in to comment.