From: Tomasz Jozwiak Date: Mon, 20 May 2019 13:26:03 +0000 (+0200) Subject: app/compress-perf: fix improper use of negative value X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e378bd76de1689b92cc5e7c45b59b9a274310553;p=dpdk.git app/compress-perf: fix improper use of negative value test_data->input_data_sz is passed to a parameter that cannot be negative. Coverity issue: 328504 Fixes: b68a82425da4 ("app/compress-perf: add performance measurement") Cc: stable@dpdk.org Signed-off-by: Tomasz Jozwiak Acked-by: Fiona Trahe --- diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index c2a45d1301..5a579eaa09 100644 --- a/app/test-compress-perf/main.c +++ b/app/test-compress-perf/main.c @@ -244,7 +244,8 @@ comp_perf_dump_input_data(struct comp_test_data *test_data) if (test_data->input_data_sz == 0) test_data->input_data_sz = actual_file_sz; - if (fseek(f, 0, SEEK_SET) != 0) { + if (test_data->input_data_sz <= 0 || actual_file_sz <= 0 || + fseek(f, 0, SEEK_SET) != 0) { RTE_LOG(ERR, USER1, "Size of input could not be calculated\n"); goto end; }