DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bernard Iremonger <bernard.iremonger@intel.com>
To: dev@dpdk.org, adrien.mazarguil@6wind.com
Cc: "Bernard.Iremonger" <Bernard.iremonger@intel.com>,
	stable@dpdk.org, Bernard Iremonger <bernard.iremonger@intel.com>
Subject: [dpdk-dev] [PATCH] librte_cmdline: fix parsing initialisation
Date: Tue, 13 Jun 2017 11:07:27 +0100	[thread overview]
Message-ID: <1497348447-1167-1-git-send-email-bernard.iremonger@intel.com> (raw)

From: "Bernard.Iremonger" <Bernard.iremonger@intel.com>

The dyn_tokens array is initialised at the beginning of
the cmdline_parse function. However when the inst_num
variable is incremented later in the function the
dyn_tokens array is not reinitialised so the tokens
from the previous command are used.

The solution is to initialise the dyn_tokens array in
the while(inst) loop.

Fixes: 4fffc05a2b2c ("cmdline: support dynamic tokens")

CC: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 lib/librte_cmdline/cmdline_parse.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c
index b814880..9ee28b8 100644
--- a/lib/librte_cmdline/cmdline_parse.c
+++ b/lib/librte_cmdline/cmdline_parse.c
@@ -276,7 +276,6 @@
 		return CMDLINE_PARSE_BAD_ARGS;
 
 	ctx = cl->ctx;
-	memset(&dyn_tokens, 0, sizeof(dyn_tokens));
 
 	/*
 	 * - look if the buffer contains at least one line
@@ -319,6 +318,7 @@
 	inst = ctx[inst_num];
 	while (inst) {
 		debug_printf("INST %d\n", inst_num);
+		memset(&dyn_tokens, 0, sizeof(dyn_tokens));
 
 		/* fully parsed */
 		tok = match_inst(inst, buf, 0, tmp_result.buf,
-- 
1.9.1

             reply	other threads:[~2017-06-13 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 10:07 Bernard Iremonger [this message]
2017-06-15 10:15 ` [dpdk-dev] [PATCH v2] " Adrien Mazarguil
2017-06-23  9:04   ` Olivier Matz
2017-07-10 12:09   ` [dpdk-dev] [PATCH v3 0/3] " Adrien Mazarguil
2017-07-10 12:09     ` [dpdk-dev] [PATCH v3 1/3] cmdline: fix dynamic tokens initialization Adrien Mazarguil
2017-07-10 12:09     ` [dpdk-dev] [PATCH v3 2/3] cmdline: fix dynamic tokens interface Adrien Mazarguil
2017-07-10 12:09     ` [dpdk-dev] [PATCH v3 3/3] app/testpmd: fix token matching in flow command Adrien Mazarguil
2017-07-20 22:08     ` [dpdk-dev] [PATCH v3 0/3] librte_cmdline: fix parsing initialisation 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=1497348447-1167-1-git-send-email-bernard.iremonger@intel.com \
    --to=bernard.iremonger@intel.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=stable@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).