DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Jiang, Cheng1" <cheng1.jiang@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	"Xia, Chenbo" <chenbo.xia@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Fu, Patrick" <patrick.fu@intel.com>,
	"Yang, YvonneX" <yvonnex.yang@intel.com>
Subject: Re: [dpdk-dev] [PATCH v1] examples/vhost: fix string split error handling issue
Date: Wed, 11 Nov 2020 00:58:00 +0000	[thread overview]
Message-ID: <SJ0PR11MB50062D3867E0C4ABEC404129DCE80@SJ0PR11MB5006.namprd11.prod.outlook.com> (raw)
In-Reply-To: <f113e4d0-709f-43db-368d-291303af935b@redhat.com>

Hi,

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Tuesday, November 10, 2020 5:35 PM
> To: Jiang, Cheng1 <cheng1.jiang@intel.com>; Xia, Chenbo
> <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Fu, Patrick <patrick.fu@intel.com>; Yang, YvonneX
> <yvonnex.yang@intel.com>
> Subject: Re: [PATCH v1] examples/vhost: fix string split error handling issue
> 
> 
> 
> On 11/6/20 4:23 AM, Cheng Jiang wrote:
> > Add checking return value of string split function to fix the coverity
> > issue.
> >
> > Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing")
> > Coverity issue: 363739
> >
> > Signed-off-by: Cheng Jiang <Cheng1.jiang@intel.com>
> > ---
> >  examples/vhost/ioat.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> >
> > diff --git a/examples/vhost/ioat.c b/examples/vhost/ioat.c index
> > b2c74f6537..04806c02d7 100644
> > --- a/examples/vhost/ioat.c
> > +++ b/examples/vhost/ioat.c
> > @@ -54,9 +54,14 @@ open_ioat(const char *value)
> >  	}
> >  	args_nr = rte_strsplit(substr, strlen(substr),
> >  			dma_arg, MAX_VHOST_DEVICE, ',');
> 
> I think you should check args_nr > 0 explicitly, and maybe even args_nr
> >= 0. And then propagate the error if condition is met.
> 

Sure, I'll fix it in the next version.

Thanks,
Cheng

> 
> > -	do {
> > +	while (i < args_nr) {
> >  		char *arg_temp = dma_arg[i];
> > -		rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2, '@');
> > +		uint8_t sub_nr;
> > +		sub_nr = rte_strsplit(arg_temp, strlen(arg_temp), ptrs, 2,
> '@');
> > +		if (sub_nr != 2) {
> > +			ret = -1;
> > +			goto out;
> > +		}
> >
> >  		start = strstr(ptrs[0], "txd");
> >  		if (start == NULL) {
> > @@ -105,7 +110,7 @@ open_ioat(const char *value)
> >
> >  		dma_info->nr++;
> >  		i++;
> > -	} while (i < args_nr);
> > +	}
> >  out:
> >  	free(input);
> >  	return ret;
> >


  reply	other threads:[~2020-11-11  0:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  3:23 Cheng Jiang
2020-11-10  9:34 ` Maxime Coquelin
2020-11-11  0:58   ` Jiang, Cheng1 [this message]
2020-11-11  9:08 ` [dpdk-dev] [PATCH v2] " Cheng Jiang
2020-11-12 16:53   ` Maxime Coquelin
2020-11-13  8:40   ` Maxime Coquelin

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=SJ0PR11MB50062D3867E0C4ABEC404129DCE80@SJ0PR11MB5006.namprd11.prod.outlook.com \
    --to=cheng1.jiang@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=patrick.fu@intel.com \
    --cc=yvonnex.yang@intel.com \
    /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).