public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Marat Khalili" <marat.khalili@huawei.com>, <dev@dpdk.org>
Cc: "Stephen Hemminger" <stephen@networkplumber.org>,
	"Christophe Fontaine" <cfontain@redhat.com>,
	"Konstantin Ananyev" <konstantin.v.ananyev@yandex.ru>,
	"Wathsala Vithanage" <wathsala.vithanage@arm.com>,
	<stable@dpdk.org>
Subject: RE: [PATCH v2] mbuf: fix read packet data
Date: Thu, 19 Mar 2026 15:31:01 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35F657A8@smartserver.smartshare.dk> (raw)
In-Reply-To: <da1693e3aef3481583356e9e7393a8fa@huawei.com>

> From: Marat Khalili [mailto:marat.khalili@huawei.com]
> Sent: Thursday, 19 March 2026 15.22
> 
> Acked-by: Marat Khalili <marat.khalili@huawei.com>
> Tested-by: Marat Khalili <marat.khalili@huawei.com>

Thank you for testing, Marat!

> 
> Good idea to clarify check texts in the test.
> 
> > diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
> > index a41d2d0f97..db23259745 100644
> > --- a/app/test/test_mbuf.c
> > +++ b/app/test/test_mbuf.c
> > @@ -2037,13 +2037,13 @@ test_pktmbuf_read_from_offset(struct
> rte_mempool *pktmbuf_pool)
> >  	/* read length greater than mbuf data_len */
> >  	if (rte_pktmbuf_read(m, hdr_len, rte_pktmbuf_data_len(m) + 1,
> >  				NULL) != NULL)
> > -		GOTO_FAIL("%s: Requested len is larger than mbuf data
> len!\n",
> > +		GOTO_FAIL("%s: Requested offset + len is larger than mbuf
> data len!\n",
> >  				__func__);
> 
> Another strange check tbh, there is nothing wrong with reading beyond
> mbuf data
> length. This only fails because we are reading beyond packet length,
> which is
> tested immediately after. I'd vote to delete it, although it has
> nothing to do
> with the patch. This is just a general comment, not an issue.

Agree.

I also noticed that the offset is not subtracted from length parameter.
Testing the corner case should be:

rte_pktmbuf_read(m, hdr_len, rte_pktmbuf_data_len(m) - hdr_len + 1,


And more tests could be added to test segmented mbufs.

But I'll leave this patch to only care about fixing the wrapping bug.

The mbufs tests can be further improved another day, if someone cares to do the work.

> 
> >
> >  	/* read length greater than mbuf pkt_len */
> >  	if (rte_pktmbuf_read(m, hdr_len, rte_pktmbuf_pkt_len(m) + 1,
> >  				NULL) != NULL)
> > -		GOTO_FAIL("%s: Requested len is larger than mbuf pkt
> len!\n",
> > +		GOTO_FAIL("%s: Requested offset + len is larger than mbuf
> pkt len!\n",
> >  				__func__);
> >
> >  	/* read data of zero len from valid offset */


  reply	other threads:[~2026-03-19 14:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  8:40 [PATCH] mbuf: fix read packet data Morten Brørup
2026-03-19  9:36 ` Marat Khalili
2026-03-19 12:43 ` [PATCH v2] " Morten Brørup
2026-03-19 13:15   ` Konstantin Ananyev
2026-03-19 13:55     ` Morten Brørup
2026-03-19 14:21   ` Marat Khalili
2026-03-19 14:31     ` Morten Brørup [this message]
2026-03-25 22:33   ` Thomas Monjalon

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=98CBD80474FA8B44BF855DF32C47DC35F657A8@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=cfontain@redhat.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    --cc=marat.khalili@huawei.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=wathsala.vithanage@arm.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