From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Xueming Li <xuemingl@mellanox.com>,
Wenzhuo Lu <wenzhuo.lu@intel.com>,
Olivier MATZ <olivier.matz@6wind.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v1] lib/cmdline: init parse result memory
Date: Fri, 8 Dec 2017 13:27:26 +0100 [thread overview]
Message-ID: <20171208122726.GT4062@6wind.com> (raw)
In-Reply-To: <20171208070244.24094-1-xuemingl@mellanox.com>
On Fri, Dec 08, 2017 at 03:02:44PM +0800, Xueming Li wrote:
> Initialize binary result memory before parsing to avoid garbage in
> parsing result.
>
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Since you chose to move the break statement, maybe the original commit
mentioned in my previous message (9b3fbb051d2e "cmdline: fix parsing") can
be reverted afterward? I think it makes tmp_result redundant.
Wenzhuo, as the author of that commit, can you confirm?
Olivier, no problem with breaking the loop immediately after the first
successful match_inst() call instead of the last one? (I don't see why it
would be an issue but I may have missed something)
> ---
> lib/librte_cmdline/cmdline_parse.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
> index 3e12ee54f..4072103f2 100644
> --- a/lib/librte_cmdline/cmdline_parse.c
> +++ b/lib/librte_cmdline/cmdline_parse.c
> @@ -168,6 +168,9 @@ match_inst(cmdline_parse_inst_t *inst, const char *buf,
> int n = 0;
> struct cmdline_token_hdr token_hdr;
>
> + if (resbuf != NULL)
> + memset(resbuf, 0, resbuf_size);
> +
> /* check if we match all tokens of inst */
> while (!nb_match_token || i < nb_match_token) {
> token_p = get_token(inst, i);
> @@ -338,8 +341,8 @@ cmdline_parse(struct cmdline *cl, const char * buf)
> err = CMDLINE_PARSE_AMBIGUOUS;
> f=NULL;
> debug_printf("Ambiguous cmd\n");
> - break;
> }
> + break;
> }
> }
>
> --
> 2.13.3
>
--
Adrien Mazarguil
6WIND
next prev parent reply other threads:[~2017-12-08 12:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-15 15:54 [PATCH] lib/cmdline: init parse result memeory Xueming Li
2017-12-07 14:48 ` Olivier MATZ
2017-12-07 15:05 ` Xueming(Steven) Li
2017-12-07 15:35 ` Xueming(Steven) Li
2017-12-07 17:13 ` Adrien Mazarguil
2017-12-08 7:02 ` [PATCH v1] lib/cmdline: init parse result memory Xueming Li
2017-12-08 12:27 ` Adrien Mazarguil [this message]
2017-12-08 13:51 ` Olivier MATZ
2017-12-08 14:50 ` Xueming(Steven) Li
2017-12-08 15:04 ` Adrien Mazarguil
2017-12-08 15:26 ` Olivier MATZ
2017-12-09 15:39 ` [PATCH v2] lib/cmdline: init CLI parsing memory Xueming Li
2017-12-14 15:35 ` Olivier MATZ
2017-12-18 10:51 ` Adrien Mazarguil
2017-12-18 13:44 ` Xueming(Steven) Li
2017-12-26 12:57 ` Xueming(Steven) Li
2018-01-16 12:45 ` Olivier Matz
2018-01-18 4:29 ` Xueming(Steven) Li
2018-01-19 9:07 ` Olivier Matz
2018-01-19 18:18 ` Xueming(Steven) Li
2018-01-19 18:16 ` [PATCH v3] cmdline: fix dynamic tokens parsing Xueming Li
2018-01-22 13:13 ` Olivier Matz
2018-01-25 22:14 ` [dpdk-stable] " 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=20171208122726.GT4062@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
--cc=wenzhuo.lu@intel.com \
--cc=xuemingl@mellanox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.