From: Haiyue Wang Date: Mon, 15 Nov 2021 06:05:09 +0000 (+0800) Subject: app/testpmd: avoid process ID out of range X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=5388be6eaea7ceaa5a922ea6a8b4dada846aaeea;p=dpdk.git app/testpmd: avoid process ID out of range The 'proc_id' should be less than 'num_procs', if not, exit the testpmd and show the error message. Fixes: a550baf24af9 ("app/testpmd: support multi-process") Signed-off-by: Haiyue Wang Acked-by: Min Hu (Connor) Reviewed-by: Ferruh Yigit --- diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 0974b0a38f..5251722d0f 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -1527,6 +1527,12 @@ launch_args_parse(int argc, char** argv) rte_exit(EXIT_FAILURE, "Command line is incorrect\n"); } + if (proc_id >= (int)num_procs) + rte_exit(EXIT_FAILURE, + "The multi-process option '%s(%d)' should be less than '%s(%u)'\n", + PARAM_PROC_ID, proc_id, + PARAM_NUM_PROCS, num_procs); + /* Set offload configuration from command line parameters. */ rx_mode.offloads = rx_offloads; tx_mode.offloads = tx_offloads;