From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: Re: [PATCH] devargs: restore empty devargs as "" Date: Tue, 24 Feb 2015 19:16:27 +0900 Message-ID: <54EC4F7B.6080907@igel.co.jp> References: <54E5ED96.9040402@igel.co.jp> <1424770891-19243-1-git-send-email-david.marchand@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Transfer-Encoding: 7bit To: David Marchand , dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1424770891-19243-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" On 2015/02/24 18:41, David Marchand wrote: > Following commit c07691ae1089, an implicit change has been done in the devargs > api. > This triggers problem in virtual pmds that did not check for parameters validity > as it was implicitely valid. > > Fix this by restoring the empty argument as "" and add a note in the api. > Restore associated tests. > > Fixes: c07691ae1089 ("devargs: remove limit on parameters length") > Reported-by: Tetsuya Mukawa > Signed-off-by: David Marchand > --- > app/test/test_devargs.c | 2 +- > lib/librte_eal/common/eal_common_devargs.c | 11 +++++++---- > lib/librte_eal/common/include/rte_devargs.h | 2 +- > 3 files changed, 9 insertions(+), 6 deletions(-) > > diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c > index 08fb781..f7fc59c 100644 > --- a/app/test/test_devargs.c > +++ b/app/test/test_devargs.c > @@ -107,7 +107,7 @@ test_devargs(void) > devargs->pci.addr.devid != 0 || > devargs->pci.addr.function != 1) > goto fail; > - if (devargs->args) > + if (!devargs->args || strcmp(devargs->args, "") != 0) > goto fail; > free_devargs_list(); > > diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c > index 3aace08..eadd719 100644 > --- a/lib/librte_eal/common/eal_common_devargs.c > +++ b/lib/librte_eal/common/eal_common_devargs.c > @@ -73,10 +73,13 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str) > if (sep != NULL) { > sep[0] = '\0'; > devargs->args = strdup(sep + 1); > - if (devargs->args == NULL) { > - RTE_LOG(ERR, EAL, "cannot allocate for devargs args\n"); > - goto fail; > - } > + } else { > + devargs->args = strdup(""); > + } > + > + if (devargs->args == NULL) { > + RTE_LOG(ERR, EAL, "cannot allocate for devargs args\n"); > + goto fail; > } > > switch (devargs->type) { > diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h > index 996e180..6834333 100644 > --- a/lib/librte_eal/common/include/rte_devargs.h > +++ b/lib/librte_eal/common/include/rte_devargs.h > @@ -88,7 +88,7 @@ struct rte_devargs { > char drv_name[32]; > } virtual; > }; > - /** Arguments string as given by user. */ > + /** Arguments string as given by user or "" for no argument. */ > char *args; > }; > Hi David, I've confirmed this patch fixes the issue descried in above comment. Thanks, Tetsuya