[1/4] app/testpmd: fix stats-period option check

Message ID 20240308144841.3615262-2-david.marchand@redhat.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers
Series testpmd options parsing cleanup |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand March 8, 2024, 2:48 p.m. UTC
  Rather than silently ignore an invalid value, raise an error for
stats-period user input.

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

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/parameters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ferruh Yigit March 12, 2024, 4:43 p.m. UTC | #1
On 3/8/2024 2:48 PM, David Marchand wrote:
> Rather than silently ignore an invalid value, raise an error for
> stats-period user input.
> 
> Fixes: cfea1f3048d1 ("app/testpmd: print statistics periodically")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
>

Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
  

Patch

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;