Subject: Re: [PATCH v9 net-next 3/4] xdp: add multi-buff support for xdp running in generic mode

From: Lorenzo Bianconi <[email-masked]>
Date: Sat, 17 Feb 2024 11:34:32 +0100

[...]
> > +	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)
>