From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 57EA5A0C4B;
	Fri, 15 Oct 2021 11:25:31 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id AFB8A411CB;
	Fri, 15 Oct 2021 11:25:30 +0200 (CEST)
Received: from mail-ua1-f43.google.com (mail-ua1-f43.google.com
 [209.85.222.43]) by mails.dpdk.org (Postfix) with ESMTP id 529EF40692
 for <dev@dpdk.org>; Fri, 15 Oct 2021 11:25:29 +0200 (CEST)
Received: by mail-ua1-f43.google.com with SMTP id h4so16752099uaw.1
 for <dev@dpdk.org>; Fri, 15 Oct 2021 02:25:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=smartx-com.20210112.gappssmtp.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=y9R8KO/xEF2YI94cLWLx5tJb4tNypdgqNoPYOmoB0F0=;
 b=zPqmV4Zu0juQEvOIyGyWRJaU2QEM93EEjTqHigYt8wvXxvD6XClUW+SCJpnqHMnXWV
 gOVBB/MPcTD7kodIM1wG8lf65C8FnX++CgHJMYP1g2Jg47rVgLGRCUAg7X6qv+ozhaYo
 DJkbhIDbXGNTPqhfJOb7NfhokEud8pB8mE/ArkNEuWp/ZzfDE2HY0N70WUum9WUsc2dp
 JjJDlCghCa0OzfvaMXWowD/1fiWtRHmTfn/SoZ18AhRAcxux6zFvYONfkvnZeknoWAx4
 X5ECr15WSU/P/aqEXGIpJ4F98GAhEPYgu7e+SrqviP7eV8WAHKE2rzWpk8VlZxjqSDUp
 7h5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=y9R8KO/xEF2YI94cLWLx5tJb4tNypdgqNoPYOmoB0F0=;
 b=I6wOT6v4xGZw/3dIekqaSVOIbaTMQNQFB1hBtQZRiqH62vAT68ZY2E+R6vNonK2IiB
 Y01QsCm20OnzG31zm8eDxmxiXUJ+dW+jNC2poXugYr5wAe8HUN7Wgee2qCcvWc7MRen6
 ZamG3opZBNd4rE5mTaXw/5v2mWFnxAr09Xc0vNziIvHQf6V6yncga/G6MTRhPicrYFOx
 72KFXdSpnxvcl2uLtGxYOgog4IOX0QF1uvlpK3FRi6PEb9yUKIK7DTQvCIxyNPBk8tCF
 FCZKWZicY7Pjw83LCFf7pDtSx5vcqbNGCdt5O4GvZKC8/XuySxEOLej/ALiszQbswXsd
 8POg==
X-Gm-Message-State: AOAM531Vo5kGuLMWhBbm+GSlRL5rPtonFeVl60I6r0rpXMQPI1es9UXJ
 uNjANolTTKqlcVkpS8wVW0FzAOO3r1EIMna30fjffg==
X-Google-Smtp-Source: ABdhPJwfjjCMJ7nPi7UWeRpJEc5JPjDnjqRVAc1sj1GVj0NLKrXDbGcguwSj7WCMllRqvtmUHXJbpaGYs5Gia56Bxko=
X-Received: by 2002:a67:fdd3:: with SMTP id l19mr12455697vsq.37.1634289928661; 
 Fri, 15 Oct 2021 02:25:28 -0700 (PDT)
MIME-Version: 1.0
References: <20210827051241.2448098-1-fengli@smartx.com>
 <20211014124008.3570044-1-fengli@smartx.com>
 <93f2ee9b-d207-c6ce-d79f-55306fd8b8f4@redhat.com>
In-Reply-To: <93f2ee9b-d207-c6ce-d79f-55306fd8b8f4@redhat.com>
From: Li Feng <fengli@smartx.com>
Date: Fri, 15 Oct 2021 17:25:16 +0800
Message-ID: <CAHckoCwC4HksDt5377biSEo_CEXCPWduEtFU_334K4Q2ZG81Qw@mail.gmail.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>
Cc: Chenbo Xia <chenbo.xia@intel.com>, Lin Li <lilin24@baidu.com>,
 Jin Yu <jin.yu@intel.com>, 
 Yu Zhang <zhangyu31@baidu.com>, Xun Ni <nixun@baidu.com>, dev@dpdk.org,
 stable@dpdk.org
Content-Type: text/plain; charset="UTF-8"
Subject: Re: [dpdk-dev] [PATCH v2] vhost: add sanity check when operating
 the split ring
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Fri, Oct 15, 2021 at 4:52 PM Maxime Coquelin
<maxime.coquelin@redhat.com> wrote:
>
> The title is too vague, I would put something like:
>
> vhost: add sanity check on inflight last index
>
> On 10/14/21 14:40, Li Feng wrote:
> > The idx in rte_vhost_set_last_inflight_io_split is from the frontend
>
> s/idx/index/
>
> > driver, check if it's in the virtqueue range.
> >
> > Fixes: bb0c2de9602b ("vhost: add APIs to operate inflight ring")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Li Feng <fengli@smartx.com>
> > ---
> >   lib/vhost/vhost.c | 3 +++
> >   1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
> > index 9540522dac..3b674ac320 100644
> > --- a/lib/vhost/vhost.c
> > +++ b/lib/vhost/vhost.c
> > @@ -1226,6 +1226,9 @@ rte_vhost_set_last_inflight_io_split(int vid, uint16_t vring_idx,
> >       if (unlikely(!vq->inflight_split))
> >               return -1;
> >
> > +     if (unlikely(idx >= vq->size))
> > +             return -1;
> > +
> >       vq->inflight_split->last_inflight_io = idx;
> >       return 0;
> >   }
> >
>
> Other than that, this is fine to me:
>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>
> If my suggestions are fine for you, I can fix while applying.
>
It's fine.

> Thanks,
> Maxime
>