DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrius Sirvys <andrius.sirvys@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Andrius Sirvys <andrius.sirvys@intel.com>,
	remy.horton@intel.com
Subject: [dpdk-dev] [PATCH] lib/bitratestats: fix unchecked return value
Date: Wed, 17 Apr 2019 16:22:28 +0100	[thread overview]
Message-ID: <20190417152228.156057-1-andrius.sirvys@intel.com> (raw)
Message-ID: <20190417152228.hVE4xiTsI44_44_-67toZ54dQ_y88AFi4BtLk3FhhtI@z> (raw)

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 <andrius.sirvys@intel.com>
---
 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


             reply	other threads:[~2019-04-17 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 15:22 Andrius Sirvys [this message]
2019-04-17 15:22 ` Andrius Sirvys
2019-04-17 19:03 ` Rami Rosen
2019-04-17 19:03   ` Rami Rosen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190417152228.156057-1-andrius.sirvys@intel.com \
    --to=andrius.sirvys@intel.com \
    --cc=dev@dpdk.org \
    --cc=remy.horton@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).