app/testpmd: avoid the process ID out of range
PATCH 1/1 app/testpmd: avoid the 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 <[email protected]>
--- app/test-pmd/parameters.c | 6 ++++++ 1 file changed, 6 insertions(+)
app/test-pmd/parameters.c +6 -0
@@ -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;
Signature · 1 line
2.33.1
Acked-by Min Hu (Connor) <[email protected]>
Quoted 28 lines · Haiyue Wang
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 <[email protected]>--- app/test-pmd/parameters.c | 6 ++++++ 1 file changed, 6 insertions(+)app/test-pmd/parameters.c +6
-0@@ -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;
Quoted 9 lines · Min Hu (Connor)
Quoted 7 lines · Haiyue Wang
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 <[email protected]>Acked-by Min Hu (Connor) <[email protected]>>
Reviewed-by Ferruh Yigit <[email protected]>
Applied to dpdk-next-net/main, thanks.