[dpdk-dev] [PATCH v1 3/4] vhost: fix async vec buf overrun
Fu, Patrick
patrick.fu at intel.com
Tue Sep 29 04:23:11 CEST 2020
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin at redhat.com>
> Sent: Wednesday, September 23, 2020 5:22 PM
> To: Fu, Patrick <patrick.fu at intel.com>; dev at dpdk.org; Xia, Chenbo
> <chenbo.xia at intel.com>
> Cc: Wang, Zhihong <zhihong.wang at intel.com>; Jiang, Cheng1
> <cheng1.jiang at intel.com>
> Subject: Re: [PATCH v1 3/4] vhost: fix async vec buf overrun
>
> s/buf/buffer/
>
> On 9/11/20 3:53 AM, Patrick Fu wrote:
> > Add check on the async vec buffer usage to prevent the buf overrun.
>
> s/vec/vector/
>
> s/buf/buffer/
>
>
> > If vec buf is not sufficient to prepare for next packet's iov
>
> same here
>
Fix in v2
> > if (pkt_burst_idx >= VHOST_ASYNC_BATCH_THRESHOLD ||
> > - (pkt_idx == count - 1 && pkt_burst_idx)) {
> > + (pkt_idx == count - 1 && pkt_burst_idx) ||
> > + VHOST_MAX_ASYNC_VEC / 2 - segs_await <
> > + BUF_VECTOR_MAX) {
>
> Parenthesis may help.
>
> Or better to refactor the code for better readability.
>
Refactor the code seems to be a little bit tricky. I will add parenthesis together with some comments to improve readability.
Thanks,
Patrick
More information about the dev
mailing list