From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9C44C04AAC for ; Mon, 20 May 2019 13:26:11 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 7E89C2054F for ; Mon, 20 May 2019 13:26:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E89C2054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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