lkml.org 
[lkml]   [2014]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] tun: Use iovec iterators
Hi,

Herbert Xu wrote:
> Oops, this patch had a left-over skb_pull which made it broken.
> Here is a fixed version.
>
> tun: Use iovec iterators
>
> This patch removes the use of skb_copy_datagram_const_iovec in
> favour of the iovec iterator-based skb_copy_datagram_iter.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index 9dd3746..ff955cdb 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
:
> @@ -1244,23 +1245,25 @@ static ssize_t tun_put_user(struct tun_struct *tun,
> if (tun->flags & TUN_VNET_HDR)
> vnet_hdr_sz = tun->vnet_hdr_sz;
>
> + total = skb->len + vlan_hlen + vnet_hdr_sz;
> +
> if (!(tun->flags & TUN_NO_PI)) {
> - if ((len -= sizeof(pi)) < 0)
> + if (iov_iter_count(iter) < sizeof(pi))
> return -EINVAL;
>
> - if (len < skb->len + vlan_hlen + vnet_hdr_sz) {
> + if (iov_iter_count(iter) < total) {

I guess this should be: sizeof(pi) + total

--
Hideaki Yoshifuji <hideaki.yoshifuji@miraclelinux.com>
Technical Division, MIRACLE LINUX CORPORATION


\
 
 \ /
  Last update: 2014-11-05 04:21    [W:0.100 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site