[dpdk-dev] [PATCH] test/eal: check invalid cpu value

Kevin Traynor ktraynor at redhat.com
Fri Jun 12 14:09:59 CEST 2020


When using --lcores option, CPU_SETSIZE allows a range of
0-1023. Check it is not being exceeded.

Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
---
 app/test/test_eal_flags.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 4ee809e3d..044cc1c59 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -528,4 +528,7 @@ test_missing_c_flag(void)
 				 "--lcores",
 				 "0-1,2@(5-7),(3-5)@(0,2),(0,6),7"};
+	/* check an invalid cpu value >= CPU_SETSIZE */
+	const char * const argv30[] = { prgname, prefix, mp_flag,
+				 "--lcores", "3 at 1024" };
 
 	if (launch_proc(argv2) != 0) {
@@ -577,5 +580,6 @@ test_missing_c_flag(void)
 	    launch_proc(argv24) == 0 || launch_proc(argv25) == 0 ||
 	    launch_proc(argv26) == 0 || launch_proc(argv27) == 0 ||
-	    launch_proc(argv28) == 0) {
+	    launch_proc(argv28) == 0 || launch_proc(argv30) == 0) {
+
 		printf("Error - "
 		       "process ran without error with invalid --lcore flag\n");
-- 
2.21.3



More information about the dev mailing list