[PATCH v2] mbuf: fix read packet data
Marat Khalili
marat.khalili at huawei.com
Thu Mar 19 15:21:33 CET 2026
Acked-by: Marat Khalili <marat.khalili at huawei.com>
Tested-by: Marat Khalili <marat.khalili at huawei.com>
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.
>
> /* 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 */
More information about the dev
mailing list