lib/bitratestats: fix unchecked return value

Message ID 20190417152228.156057-1-andrius.sirvys@intel.com
State Superseded, archived
Headers show
Series
  • lib/bitratestats: fix unchecked return value
Related show

Checks

Context Check Description
ci/Performance-Testing fail build patch failure
ci/Intel-compilation fail Compilation issues
ci/checkpatch warning coding style issues

Commit Message

Andrius Sirvys April 17, 2019, 3:22 p.m.
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(-)

Comments

Rami Rosen April 17, 2019, 7:03 p.m. | #1
Acked-by: Rami Rosen <ramirose@gmail.com>

Patch

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;
 }