Netdev List
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Yunsheng Lin <linyunsheng@huawei.com>
Cc: davem@davemloft.net, hch@lst.de, netdev@vger.kernel.org
Subject: Re: [PATCH v3 2/7] net: Use skb accessors in network core
Date: Tue, 23 Jul 2019 04:17:55 -0700	[thread overview]
Message-ID: <20190723111755.GI363@bombadil.infradead.org> (raw)
In-Reply-To: <aa40f270-9f55-323a-2e94-5bd326a7a142@huawei.com>

On Tue, Jul 23, 2019 at 11:56:41AM +0800, Yunsheng Lin wrote:
> > diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> > index 6f1e31f674a3..e32081709a0d 100644
> > --- a/net/core/skbuff.c
> > +++ b/net/core/skbuff.c
> > @@ -2975,11 +2975,15 @@ skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen)
> >  	skb_zerocopy_clone(to, from, GFP_ATOMIC);
> >  
> >  	for (i = 0; i < skb_shinfo(from)->nr_frags; i++) {
> > +		int size;
> > +
> >  		if (!len)
> >  			break;
> >  		skb_shinfo(to)->frags[j] = skb_shinfo(from)->frags[i];
> > -		skb_shinfo(to)->frags[j].size = min_t(int, skb_shinfo(to)->frags[j].size, len);
> > -		len -= skb_shinfo(to)->frags[j].size;
> > +		size = min_t(int, skb_frag_size(&skb_shinfo(to)->frags[j]),
> > +					len);
> 
> It seems skb_frag_size returns unsigned int here, maybe:
> 
> unsigned int size;
> 
> size = min_t(unsigned int, skb_frag_size(&skb_shinfo(to)->frags[j]),
> 
> The original code also do not seem to using the correct min_t, but
> perhaps it is better to clean that up too?

A signed size also doesn't make sense to me, but I wasn't sufficiently
certain to make that change.  Please feel free to send a followup patch
for people to consider.

  reply	other threads:[~2019-07-23 11:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23  3:08 [PATCH v3 0/7] Convert skb_frag_t to bio_vec Matthew Wilcox
2019-07-23  3:08 ` [PATCH v3 1/7] net: Use skb accessors in network drivers Matthew Wilcox
2019-07-23  3:08 ` [PATCH v3 2/7] net: Use skb accessors in network core Matthew Wilcox
2019-07-23  3:56   ` Yunsheng Lin
2019-07-23 11:17     ` Matthew Wilcox [this message]
2019-07-23  3:08 ` [PATCH v3 3/7] net: Increase the size of skb_frag_t Matthew Wilcox
2019-07-23  3:08 ` [PATCH v3 4/7] net: Reorder the contents " Matthew Wilcox
2019-07-23  3:08 ` [PATCH v3 5/7] net: Rename skb_frag page to bv_page Matthew Wilcox
2019-07-23  3:08 ` [PATCH v3 6/7] net: Rename skb_frag_t size to bv_len Matthew Wilcox
2019-07-24 10:49   ` David Laight
2019-07-24 11:41     ` Matthew Wilcox
2019-07-24 18:46       ` David Miller
2019-07-23  3:08 ` [PATCH v3 7/7] net: Convert skb_frag_t to bio_vec Matthew Wilcox
2019-07-23  3:48 ` [PATCH v3 0/7] " David Miller
2019-07-25 16:26 ` Jonathan Lemon
  -- strict thread matches above, loose matches on Subject: below --
2019-07-12 13:43 Matthew Wilcox
2019-07-12 13:43 ` [PATCH v3 2/7] net: Use skb accessors in network core Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723111755.GI363@bombadil.infradead.org \
    --to=willy@infradead.org \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=linyunsheng@huawei.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox