app/crypto-perf: add options parsing check
[dpdk.git] / app / test-crypto-perf / cperf_options_parsing.c
index 691e788..c1d5ffc 100644 (file)
@@ -128,7 +128,13 @@ parse_total_ops(struct cperf_options *opts, const char *arg)
        int ret = parse_uint32_t(&opts->total_ops, arg);
 
        if (ret)
-               RTE_LOG(ERR, USER1, "failed to parse total operations count");
+               RTE_LOG(ERR, USER1, "failed to parse total operations count\n");
+
+       if (opts->total_ops == 0) {
+               RTE_LOG(ERR, USER1,
+                               "invalid total operations count number specified\n");
+               return -1;
+       }
 
        return ret;
 }