From mboxrd@z Thu Jan 1 00:00:00 1970 From: YOSHIFUJI Hideaki Subject: Re: [PATCH 2/4] tun: Use iovec iterators Date: Wed, 05 Nov 2014 11:49:16 +0900 Message-ID: <5459902C.1010102@miraclelinux.com> References: <20141104033818.GA11149@gondor.apana.org.au> <20141104083721.GA12691@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: hideaki.yoshifuji@miraclelinux.com To: Herbert Xu , Al Viro , "David S. Miller" , netdev@vger.kernel.org, Linux Kernel Mailing List , Benjamin LaHaise Return-path: In-Reply-To: <20141104083721.GA12691@gondor.apana.org.au> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org 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 > > 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 Technical Division, MIRACLE LINUX CORPORATION