Fix potential crash in parsing unusual commands 34/71334/2
authorXavier Simonart <xavier.simonart@intel.com>
Fri, 30 Oct 2020 15:46:31 +0000 (16:46 +0100)
committerXavier Simonart <xavier.simonart@intel.com>
Tue, 10 Nov 2020 10:35:10 +0000 (11:35 +0100)
'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 <xavier.simonart@intel.com>
VNFs/DPPD-PROX/cmd_parser.c

index 00027c4..7d216ba 100644 (file)
@@ -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);