From: Xavier Simonart Date: Fri, 30 Oct 2020 15:46:31 +0000 (+0100) Subject: Fix potential crash in parsing unusual commands X-Git-Tag: opnfv-10.0.0~9 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F34%2F71334%2F2;p=samplevnf.git Fix potential crash in parsing unusual commands 'reset values all' and 'reset randoms all' commands were potentially causing some crash. This has been fixed. Change-Id: Idc2c4f7c90db73e7fdf9e8ef76b00ba956a0d854 Signed-off-by: Xavier Simonart --- diff --git a/VNFs/DPPD-PROX/cmd_parser.c b/VNFs/DPPD-PROX/cmd_parser.c index 00027c47..7d216ba8 100644 --- a/VNFs/DPPD-PROX/cmd_parser.c +++ b/VNFs/DPPD-PROX/cmd_parser.c @@ -709,7 +709,7 @@ static int parse_cmd_reset_randoms_all(const char *str, struct input *input) unsigned task_id, lcore_id = -1; while (prox_core_next(&lcore_id, 0) == 0) { for (task_id = 0; task_id < lcore_cfg[lcore_id].n_tasks_all; task_id++) { - if (!task_is_mode(lcore_id, task_id, "gen")) { + if (task_is_mode(lcore_id, task_id, "gen")) { struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id]; uint32_t n_rands = task_gen_get_n_randoms(tbase); @@ -730,7 +730,7 @@ static int parse_cmd_reset_values_all(const char *str, struct input *input) unsigned task_id, lcore_id = -1; while (prox_core_next(&lcore_id, 0) == 0) { for (task_id = 0; task_id < lcore_cfg[lcore_id].n_tasks_all; task_id++) { - if (!task_is_mode(lcore_id, task_id, "gen")) { + if (task_is_mode(lcore_id, task_id, "gen")) { struct task_base *tbase = lcore_cfg[lcore_id].tasks_all[task_id]; plog_info("Resetting values on core %d task %d\n", lcore_id, task_id);