From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 94FBFA05D3 for ; Mon, 20 May 2019 15:26:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1FBC15A44; Mon, 20 May 2019 15:26:10 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id E39244C80; Mon, 20 May 2019 15:26:08 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 May 2019 06:26:07 -0700 X-ExtLoop1: 1 Received: from tjozwiax-mobl1.ger.corp.intel.com (HELO localhost.localdomain) ([10.103.104.46]) by fmsmga001.fm.intel.com with ESMTP; 20 May 2019 06:26:05 -0700 From: Tomasz Jozwiak To: dev@dpdk.org, fiona.trahe@intel.com, tomaszx.jozwiak@intel.com, shallyv@marvell.com, stable@dpdk.org Date: Mon, 20 May 2019 15:26:03 +0200 Message-Id: <1558358764-32053-1-git-send-email-tomaszx.jozwiak@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] app/test-compress-perf: fix improper use of negative value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes coverity issue: 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 --- app/test-compress-perf/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c index c2a45d1..5a579ea 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; } -- 2.7.4