[PATCH v2 1/6] app/testpmd: fix stats-period option check

David Marchand david.marchand at redhat.com
Thu Mar 14 10:17:02 CET 2024


Rather than silently ignore an invalid value, raise an error for
stats-period user input.

Fixes: cfea1f3048d1 ("app/testpmd: print statistics periodically")
Cc: stable at dpdk.org

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
 app/test-pmd/parameters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 11b0cce577..d715750bb8 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -776,7 +776,7 @@ launch_args_parse(int argc, char** argv)
 				n = strtoul(optarg, &end, 10);
 				if ((optarg[0] == '\0') || (end == NULL) ||
 						(*end != '\0'))
-					break;
+					rte_exit(EXIT_FAILURE, "Invalid stats-period value\n");
 
 				stats_period = n;
 				break;
-- 
2.44.0



More information about the stable mailing list