> -----Original Message-----
> From: Maxime Coquelin <maxime.coque...@redhat.com>
> Sent: Wednesday, September 23, 2020 5:22 PM
> To: Fu, Patrick <patrick...@intel.com>; dev@dpdk.org; Xia, Chenbo
> <chenbo....@intel.com>
> Cc: Wang, Zhihong <zhihong.w...@intel.com>; Jiang, Cheng1
> <cheng1.ji...@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

Reply via email to