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 5B8BBA00E6 for ; Thu, 18 Apr 2019 10:52:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 21CB81B92D; Thu, 18 Apr 2019 10:52:39 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 4FB1C1B8FA; Thu, 18 Apr 2019 10:52:33 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Apr 2019 01:52:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,365,1549958400"; d="scan'208";a="132378753" Received: from silpixa00380299.ir.intel.com (HELO silpixa00380299.ger.corp.intel.com) ([10.237.222.253]) by orsmga007.jf.intel.com with ESMTP; 18 Apr 2019 01:52:31 -0700 From: Andrius Sirvys To: dev@dpdk.org Cc: stable@dpdk.org, Andrius Sirvys , remy.horton@intel.com Date: Thu, 18 Apr 2019 09:52:06 +0100 Message-Id: <20190418085206.86048-1-andrius.sirvys@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return value X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Checking the return value of rte_metrics_update_values, if failed returning that value. Coverity had picked up that that the return value wasn't being checked. Coverity issue: 336863 Fixes: 2ad7ba9a6567 ("bitrate: add bitrate statistics library") Cc: remy.horton@intel.com Signed-off-by: Andrius Sirvys Acked-by: Rami Rosen --- v2: Fixed checkpatch warnings and build failures --- lib/librte_bitratestats/rte_bitrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c index c4b28f624..639e47547 100644 --- a/lib/librte_bitratestats/rte_bitrate.c +++ b/lib/librte_bitratestats/rte_bitrate.c @@ -67,6 +67,7 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data, int64_t delta; const int64_t alpha_percent = 20; uint64_t values[6]; + int ret; if (bitrate_data == NULL) return -EINVAL; @@ -124,7 +125,10 @@ rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data, values[3] = port_data->mean_obits; values[4] = port_data->peak_ibits; values[5] = port_data->peak_obits; - rte_metrics_update_values(port_id, bitrate_data->id_stats_set, + ret = rte_metrics_update_values(port_id, bitrate_data->id_stats_set, values, ARRAY_SIZE(values)); + if (ret < 0) + return ret; + return 0; } -- 2.17.1