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 AB101A00E6 for ; Wed, 17 Apr 2019 17:22:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD2B71B6EF; Wed, 17 Apr 2019 17:22:42 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id D69C11B698; Wed, 17 Apr 2019 17:22:40 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 08:22:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,362,1549958400"; d="scan'208";a="136599156" Received: from silpixa00380299.ir.intel.com (HELO silpixa00380299.ger.corp.intel.com) ([10.237.222.253]) by orsmga006.jf.intel.com with ESMTP; 17 Apr 2019 08:22:38 -0700 From: Andrius Sirvys To: dev@dpdk.org Cc: stable@dpdk.org, Andrius Sirvys , remy.horton@intel.com Date: Wed, 17 Apr 2019 16:22:28 +0100 Message-Id: <20190417152228.156057-1-andrius.sirvys@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] lib/bitratestats: fix unchecked return 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190417152228.hVE4xiTsI44_44_-67toZ54dQ_y88AFi4BtLk3FhhtI@z> 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 --- lib/librte_bitratestats/rte_bitrate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c index c4b28f624..f0e16b3c1 100644 --- a/lib/librte_bitratestats/rte_bitrate.c +++ b/lib/librte_bitratestats/rte_bitrate.c @@ -124,7 +124,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