From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <david.marchand@6wind.com>
Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com
 [209.85.219.195]) by dpdk.org (Postfix) with ESMTP id 7214F34F3
 for <dev@dpdk.org>; Thu, 13 Sep 2018 08:56:01 +0200 (CEST)
Received: by mail-yb1-f195.google.com with SMTP id y20-v6so2826757ybi.13
 for <dev@dpdk.org>; Wed, 12 Sep 2018 23:56:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to
 :cc; bh=lFO7N0VGRalzKsmWedGFySUS+LW3Pt3wCejvzikieY4=;
 b=IX2TPSTYFjxJB1A3FqQRYYxFGpG3P550QKMqMrifeuatr26ko6VDjpG3ONLjBeYIcT
 4om4gLgNgN1Yl+rCG//nol3OzYV6JJMXW7hf5nsI92KFh3QUxYuK/IckwZqiLCpuem/8
 CnyvjnCtAWlEMy0xvbKmyEtgGei6qyxnOYB66g9FBZ42Rx4S7JITZEN4SaSoTqobOg3q
 u1n6CCMxZhJ8wmBba+trLje/tF1hmbAsgguUUxnxQabX96o8OKAuYMmmVclKVZuWZZ3x
 rnLW02AvmiVRkCHTz/txBKn+uox+72py2W+d83mSeH5S3DN0hUM9iRDFaWMxFvTTpUcN
 8inw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to:cc;
 bh=lFO7N0VGRalzKsmWedGFySUS+LW3Pt3wCejvzikieY4=;
 b=IyT7J7hjw4aK9gkF60AFYs1jpC4xdt6v0hpTBKly7Mi3KcIHjJqrgIPidyeYbRqCjR
 BE6Evkx89F89F2xJNbmis3IJJv9BdK22tsu7haHfjEAlhNncLQWQnzEV0KwAs8LEBrnO
 L0JPExa8RJMoTR+jc7ObNkacZ8t3WmNsU32GdD38QVQwAyslZ+e7FjKwWuHMnBOHsrQn
 nUHhyhNNNIWZs4vgcEpoyZLDyCsMJ4nj0RbgydcbccV/31L3l3pwSYW86jA83nUAJmmf
 WqYvPigdP51dmZKaRGIa8uyBumtxifpPWgs7U1QNVWhll+1pux8cYKPkD7qu/AJmq3xn
 BveA==
X-Gm-Message-State: APzg51CEU9g44iFwXZVjpt5xsyuGzz9qfbQEdBdydh/nOQf8jqNuQ+bl
 RUaT2vrtWP9snN3iK6phrJ7QpnVMevvdHrvR2kvXwg==
X-Google-Smtp-Source: ANB0VdYA73uwk572E/pICkl5Kwo8Z1V75Ro3oqaKCVQ5lUhorMAhzK2y1U6NPH0WwKe9Kd7TTJOL2VTyNapRZwSiyM0=
X-Received: by 2002:a25:938d:: with SMTP id
 a13-v6mr2796439ybm.104.1536821760482; 
 Wed, 12 Sep 2018 23:56:00 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a25:4bc3:0:0:0:0:0 with HTTP; Wed, 12 Sep 2018 23:55:40
 -0700 (PDT)
In-Reply-To: <66B1F5CF-996B-4454-B4A6-25C799649860@mellanox.com>
References: <20180910054547.18494-1-david.marchand@6wind.com>
 <20180910054547.18494-2-david.marchand@6wind.com>
 <66B1F5CF-996B-4454-B4A6-25C799649860@mellanox.com>
From: David Marchand <david.marchand@6wind.com>
Date: Thu, 13 Sep 2018 08:55:40 +0200
Message-ID: <CALwxeUsxu7m-MaNG=VHmT_1BRjjL++4TrKkp0QZNWqKidAmR-A@mail.gmail.com>
To: Yongseok Koh <yskoh@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
 "olivier.matz@6wind.com" <olivier.matz@6wind.com>, 
 "wenzhuo.lu@intel.com" <wenzhuo.lu@intel.com>,
 "jingjing.wu@intel.com" <jingjing.wu@intel.com>, 
 "bernard.iremonger@intel.com" <bernard.iremonger@intel.com>
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH 1/3] mbuf: add sanity checks on segment
	metadata
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Thu, 13 Sep 2018 06:56:01 -0000

Hello Yongseok,

On Tue, Sep 11, 2018 at 8:16 PM, Yongseok Koh <yskoh@mellanox.com> wrote:
>
>> On Sep 9, 2018, at 10:45 PM, David Marchand <david.marchand@6wind.com> wrote:
>>
>> Add some basic checks 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 | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
>> index e714c5a59..137a320ed 100644
>> --- a/lib/librte_mbuf/rte_mbuf.c
>> +++ b/lib/librte_mbuf/rte_mbuf.c
>> @@ -200,6 +200,11 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)
>>       pkt_len = m->pkt_len;
>>
>>       do {
>> +             if (m->data_off > m->buf_len)
>> +                     rte_panic("data offset too big in mbuf segment\n");
>> +             if ((uint32_t)m->data_off + (uint32_t)m->data_len >
>> +                             (uint32_t)m->buf_len)
>
> Casting to uint32_t is needed? All of the three fields are uint16_t and it would
> anyway happen because of the integer promotion rule. Right?

Indeed, this is unnecessary.
Will send a v2 without this.


-- 
David Marchand