From: Tetsuya Mukawa <mukawa@igel.co.jp>
To: David Marchand <david.marchand@6wind.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] devargs: restore empty devargs as ""
Date: Tue, 24 Feb 2015 19:16:27 +0900 [thread overview]
Message-ID: <54EC4F7B.6080907@igel.co.jp> (raw)
In-Reply-To: <1424770891-19243-1-git-send-email-david.marchand@6wind.com>
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 <mukawa@igel.co.jp>
> Signed-off-by: David Marchand <david.marchand@6wind.com>
> ---
> 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
next prev parent reply other threads:[~2015-02-24 10:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-19 14:05 [dpdk-dev] 2nd parameter of driver init function can be NULL using latest code Tetsuya Mukawa
2015-02-24 9:41 ` [dpdk-dev] [PATCH] devargs: restore empty devargs as "" David Marchand
2015-02-24 10:16 ` Tetsuya Mukawa [this message]
2015-02-24 19:24 ` Thomas Monjalon
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=54EC4F7B.6080907@igel.co.jp \
--to=mukawa@igel.co.jp \
--cc=david.marchand@6wind.com \
--cc=dev@dpdk.org \
/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).