From: David Marchand <david.marchand@6wind.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: dev@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,
Ferruh Yigit <ferruh.yigit@intel.com>,
Andrew Rybchenko <arybchenko@solarflare.com>
Subject: Re: [dpdk-dev] [RFC 1/2] mbuf: add a sanity check on segment metadata
Date: Thu, 23 Aug 2018 09:45:31 +0200 [thread overview]
Message-ID: <CALwxeUsFhLWa==6JmJtO+JyUqL_Ly3s_+t1NQwVa0KAung8CMQ@mail.gmail.com> (raw)
In-Reply-To: <20180823073942.qnyk3jwqecm6wk3v@platinum>
On Thu, Aug 23, 2018 at 9:39 AM, Olivier Matz <olivier.matz@6wind.com> wrote:
> On Mon, Aug 13, 2018 at 06:03:45PM +0200, David Marchand wrote:
>> Add some basic check on the segments offset and length metadata:
>> always funny to have a < 0 tailroom cast to uint16_t ;-).
>>
>> Signed-off-by: David Marchand <david.marchand@6wind.com>
>> ---
>> lib/librte_mbuf/rte_mbuf.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
>> index e714c5a..7eeef12 100644
>> --- a/lib/librte_mbuf/rte_mbuf.c
>> +++ b/lib/librte_mbuf/rte_mbuf.c
>> @@ -200,6 +200,8 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
>> pkt_len = m->pkt_len;
>>
>> do {
>> + if (m->data_off + m->data_len > m->buf_len)
>> + rte_panic("bad segment metadata\n");
>
> What about spliting the test into two? This would help to clarify
> the error messages. I also suggest add casts to uint32 to ensure
> that there is no overflow.
Sure, will do.
--
David Marchand
prev parent reply other threads:[~2018-08-23 7:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-13 16:03 David Marchand
2018-08-13 16:03 ` [dpdk-dev] [RFC 2/2] ethdev: check received mbufs sanity David Marchand
2018-08-24 10:17 ` David Marchand
2018-08-23 7:39 ` [dpdk-dev] [RFC 1/2] mbuf: add a sanity check on segment metadata Olivier Matz
2018-08-23 7:45 ` David Marchand [this message]
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='CALwxeUsFhLWa==6JmJtO+JyUqL_Ly3s_+t1NQwVa0KAung8CMQ@mail.gmail.com' \
--to=david.marchand@6wind.com \
--cc=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=olivier.matz@6wind.com \
--cc=thomas@monjalon.net \
/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;
as well as URLs for NNTP newsgroup(s).