public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Julian Wiedmann <jwiedmann.dev@gmail.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
	netdev@vger.kernel.org, kuba@kernel.org, davem@davemloft.net,
	edumazet@google.com, pabeni@redhat.com, bpf@vger.kernel.org,
	toke@redhat.com, willemdebruijn.kernel@gmail.com,
	jasowang@redhat.com, sdf@google.com, hawk@kernel.org,
	ilias.apalodimas@linaro.org, linyunsheng@huawei.com
Subject: Re: [PATCH v9 net-next 3/4] xdp: add multi-buff support for xdp running in generic mode
Date: Sat, 17 Feb 2024 11:34:32 +0100	[thread overview]
Message-ID: <ZdCLuFZu_94_HTz5@lore-desk> (raw)
In-Reply-To: <8b68b781-879a-43b5-be41-7b5f75342daf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]

[...]
> > +	nskb = napi_build_skb(data, truesize);
> > +	if (!nskb) {
> > +		page_pool_free_va(pool, data, true);
> > +		return -ENOMEM;
> > +	}
> > +
> > +	skb_reserve(nskb, headroom);
> > +	skb_copy_header(nskb, skb);
> > +	skb_mark_for_recycle(nskb);
> > +
> > +	err = skb_copy_bits(skb, 0, nskb->data, size);
> > +	if (err) {
> > +		consume_skb(nskb);
> > +		return err;
> > +	}
> > +	skb_put(nskb, size);
> > +
> > +	head_off = skb_headroom(nskb) - skb_headroom(skb);
> > +	skb_headers_offset_update(nskb, head_off);
> > +
> > +	off = size;
> > +	len = skb->len - off;
> > +	for (i = 0; i < MAX_SKB_FRAGS && off < skb->len; i++) {
> > +		struct page *page;
> > +		u32 page_off;
> > +
> > +		size = min_t(u32, len, PAGE_SIZE);
> > +		truesize = size;
> > +
> > +		page = page_pool_dev_alloc(pool, &page_off, &truesize);
> > +		if (!data) {

ack, right. I will post a fix, thx for reporting the issue.

Regards,
Lorenzo

> > +			consume_skb(nskb);
> > +			return -ENOMEM;
> > +		}
> > +
> 
> This should check for !page instead, no?
> 
> (picked up as CID 1583654 by the coverity scan for linux-next)
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2024-02-17 10:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  9:50 [PATCH v9 net-next 0/4] add multi-buff support for xdp running in generic mode Lorenzo Bianconi
2024-02-12  9:50 ` [PATCH v9 net-next 1/4] net: add generic percpu page_pool allocator Lorenzo Bianconi
2024-02-12  9:50 ` [PATCH v9 net-next 2/4] xdp: rely on skb pointer reference in do_xdp_generic and netif_receive_generic_xdp Lorenzo Bianconi
2024-02-12  9:50 ` [PATCH v9 net-next 3/4] xdp: add multi-buff support for xdp running in generic mode Lorenzo Bianconi
2024-02-17 10:07   ` Julian Wiedmann
2024-02-17 10:34     ` Lorenzo Bianconi [this message]
2024-02-12  9:50 ` [PATCH v9 net-next 4/4] veth: rely on skb_pp_cow_data utility routine Lorenzo Bianconi
2024-02-14  3:50 ` [PATCH v9 net-next 0/4] add multi-buff support for xdp running in generic mode patchwork-bot+netdevbpf

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=ZdCLuFZu_94_HTz5@lore-desk \
    --to=lorenzo.bianconi@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=jwiedmann.dev@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linyunsheng@huawei.com \
    --cc=lorenzo@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    --cc=toke@redhat.com \
    --cc=willemdebruijn.kernel@gmail.com \
    /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