DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] lib/bitratestats: fix unchecked return value
@ 2019-04-18  8:52 Andrius Sirvys
  2019-04-18  8:52 ` Andrius Sirvys
  2019-04-18  9:21 ` [dpdk-dev] [dpdk-stable] " Mcnamara, John
  0 siblings, 2 replies; 6+ messages in thread
From: Andrius Sirvys @ 2019-04-18  8:52 UTC (permalink / raw)
  To: dev; +Cc: stable, Andrius Sirvys, remy.horton

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>
Acked-by: Rami Rosen <ramirose@gmail.com>
---
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] lib/bitratestats: fix unchecked return value
  2019-04-18  8:52 [dpdk-dev] [PATCH v2] lib/bitratestats: fix unchecked return value Andrius Sirvys
@ 2019-04-18  8:52 ` Andrius Sirvys
  2019-04-18  9:21 ` [dpdk-dev] [dpdk-stable] " Mcnamara, John
  1 sibling, 0 replies; 6+ messages in thread
From: Andrius Sirvys @ 2019-04-18  8:52 UTC (permalink / raw)
  To: dev; +Cc: stable, Andrius Sirvys, remy.horton

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>
Acked-by: Rami Rosen <ramirose@gmail.com>
---
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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return value
  2019-04-18  8:52 [dpdk-dev] [PATCH v2] lib/bitratestats: fix unchecked return value Andrius Sirvys
  2019-04-18  8:52 ` Andrius Sirvys
@ 2019-04-18  9:21 ` Mcnamara, John
  2019-04-18  9:21   ` Mcnamara, John
  2019-04-22 22:20   ` Thomas Monjalon
  1 sibling, 2 replies; 6+ messages in thread
From: Mcnamara, John @ 2019-04-18  9:21 UTC (permalink / raw)
  To: Sirvys, Andrius, dev; +Cc: stable, Sirvys, Andrius, remy.horton



> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Andrius Sirvys
> Sent: Thursday, April 18, 2019 9:52 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Sirvys, Andrius <andrius.sirvys@intel.com>;
> remy.horton@intel.com
> Subject: [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return
> value
> 
> 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>
> Acked-by: Rami Rosen <ramirose@gmail.com>


Acked-by: John McNamara <john.mcnamara@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return value
  2019-04-18  9:21 ` [dpdk-dev] [dpdk-stable] " Mcnamara, John
@ 2019-04-18  9:21   ` Mcnamara, John
  2019-04-22 22:20   ` Thomas Monjalon
  1 sibling, 0 replies; 6+ messages in thread
From: Mcnamara, John @ 2019-04-18  9:21 UTC (permalink / raw)
  To: Sirvys, Andrius, dev; +Cc: stable, Sirvys, Andrius, remy.horton



> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Andrius Sirvys
> Sent: Thursday, April 18, 2019 9:52 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Sirvys, Andrius <andrius.sirvys@intel.com>;
> remy.horton@intel.com
> Subject: [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return
> value
> 
> 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>
> Acked-by: Rami Rosen <ramirose@gmail.com>


Acked-by: John McNamara <john.mcnamara@intel.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return value
  2019-04-18  9:21 ` [dpdk-dev] [dpdk-stable] " Mcnamara, John
  2019-04-18  9:21   ` Mcnamara, John
@ 2019-04-22 22:20   ` Thomas Monjalon
  2019-04-22 22:20     ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2019-04-22 22:20 UTC (permalink / raw)
  To: Sirvys, Andrius; +Cc: stable, Mcnamara, John, dev

> > 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>
> > Acked-by: Rami Rosen <ramirose@gmail.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>

+Cc: stable

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] lib/bitratestats: fix unchecked return value
  2019-04-22 22:20   ` Thomas Monjalon
@ 2019-04-22 22:20     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2019-04-22 22:20 UTC (permalink / raw)
  To: Sirvys, Andrius; +Cc: stable, Mcnamara, John, dev

> > 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>
> > Acked-by: Rami Rosen <ramirose@gmail.com>
> 
> Acked-by: John McNamara <john.mcnamara@intel.com>

+Cc: stable

Applied, thanks



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-22 22:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18  8:52 [dpdk-dev] [PATCH v2] lib/bitratestats: fix unchecked return value Andrius Sirvys
2019-04-18  8:52 ` Andrius Sirvys
2019-04-18  9:21 ` [dpdk-dev] [dpdk-stable] " Mcnamara, John
2019-04-18  9:21   ` Mcnamara, John
2019-04-22 22:20   ` Thomas Monjalon
2019-04-22 22:20     ` Thomas Monjalon

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).