patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] librte_cmdline: fix parsing initialisation
@ 2017-06-13 10:07 Bernard Iremonger
  2017-06-15 10:15 ` [dpdk-stable] [PATCH v2] " Adrien Mazarguil
  0 siblings, 1 reply; 6+ messages in thread
From: Bernard Iremonger @ 2017-06-13 10:07 UTC (permalink / raw)
  To: dev, adrien.mazarguil; +Cc: Bernard.Iremonger, stable, Bernard Iremonger

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-10 12:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-13 10:07 [dpdk-stable] [PATCH] librte_cmdline: fix parsing initialisation Bernard Iremonger
2017-06-15 10:15 ` [dpdk-stable] [PATCH v2] " Adrien Mazarguil
2017-06-23  9:04   ` Olivier Matz
     [not found]   ` <cover.1499687422.git.adrien.mazarguil@6wind.com>
2017-07-10 12:09     ` [dpdk-stable] [PATCH v3 1/3] cmdline: fix dynamic tokens initialization Adrien Mazarguil
2017-07-10 12:09     ` [dpdk-stable] [PATCH v3 2/3] cmdline: fix dynamic tokens interface Adrien Mazarguil
2017-07-10 12:09     ` [dpdk-stable] [PATCH v3 3/3] app/testpmd: fix token matching in flow command Adrien Mazarguil

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).