From d27befd0b60cb5af63445ccf357443390efc1df3 Mon Sep 17 00:00:00 2001 From: Kuba Kozak Date: Tue, 7 Feb 2017 13:20:16 +0100 Subject: [PATCH] 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 --- app/test-crypto-perf/cperf_options_parsing.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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; } -- 2.20.1