From: Kuba Kozak Date: Tue, 7 Feb 2017 12:20:16 +0000 (+0100) Subject: app/crypto-perf: add options parsing check X-Git-Tag: spdx-start~4510 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d27befd0b60cb5af63445ccf357443390efc1df3;p=dpdk.git app/crypto-perf: add options parsing check Added total_ops value validation in parse_total_ops() function. Coverity issue: 141070 Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Signed-off-by: Kuba Kozak Acked-by: Pablo de Lara --- diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 691e7889a1..c1d5ffc19e 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -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; }