DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] metrics: fix Coverity warnings
@ 2017-05-11 12:53 Remy Horton
  2017-06-05 13:32 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Remy Horton @ 2017-05-11 12:53 UTC (permalink / raw)
  To: dev

Fixes memory access errors detected by Coverity.
All cases are the maximum permissable value causing an
out-by-one overrun.

Coverity issue 143433: Memory - illigal access
Coverity issue 143434: Memory - illigal access
Coverity issue 143460: Memory - corruptins
Coverity issue 143464: Memory - illigal access

Fixes: 349950ddb9c5 ("metrics: add information metrics library")

Signed-off-by: Remy Horton <remy.horton@intel.com>
---
 lib/librte_metrics/rte_metrics.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/librte_metrics/rte_metrics.c b/lib/librte_metrics/rte_metrics.c
index e9a122c..6e61f9b 100644
--- a/lib/librte_metrics/rte_metrics.c
+++ b/lib/librte_metrics/rte_metrics.c
@@ -51,7 +51,7 @@
  */
 struct rte_metrics_meta_s {
 	/** Name of metric */
-	char name[RTE_METRICS_MAX_NAME_LEN];
+	char name[RTE_METRICS_MAX_NAME_LEN + 1];
 	/** Current value for metric */
 	uint64_t value[RTE_MAX_ETHPORTS];
 	/** Used for global metrics */
@@ -176,7 +176,7 @@ rte_metrics_update_values(int port_id,
 	uint16_t cnt_setsize;
 
 	if (port_id != RTE_METRICS_GLOBAL &&
-			(port_id < 0 || port_id > RTE_MAX_ETHPORTS))
+			(port_id < 0 || port_id >= RTE_MAX_ETHPORTS))
 		return -EINVAL;
 
 	if (values == NULL)
@@ -263,7 +263,7 @@ rte_metrics_get_values(int port_id,
 	int return_value;
 
 	if (port_id != RTE_METRICS_GLOBAL &&
-			(port_id < 0 || port_id > RTE_MAX_ETHPORTS))
+			(port_id < 0 || port_id >= RTE_MAX_ETHPORTS))
 		return -EINVAL;
 
 	memzone = rte_memzone_lookup(RTE_METRICS_MEMZONE_NAME);
-- 
2.5.5

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

* Re: [dpdk-dev] [PATCH v1] metrics: fix Coverity warnings
  2017-05-11 12:53 [dpdk-dev] [PATCH v1] metrics: fix Coverity warnings Remy Horton
@ 2017-06-05 13:32 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-06-05 13:32 UTC (permalink / raw)
  To: Remy Horton; +Cc: dev

11/05/2017 14:53, Remy Horton:
> Fixes memory access errors detected by Coverity.
> All cases are the maximum permissable value causing an
> out-by-one overrun.
> 
> Coverity issue 143433: Memory - illigal access
> Coverity issue 143434: Memory - illigal access
> Coverity issue 143460: Memory - corruptins
> Coverity issue 143464: Memory - illigal access
> 
> Fixes: 349950ddb9c5 ("metrics: add information metrics library")
> 
> Signed-off-by: Remy Horton <remy.horton@intel.com>

Applied, thanks

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

end of thread, other threads:[~2017-06-05 13:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 12:53 [dpdk-dev] [PATCH v1] metrics: fix Coverity warnings Remy Horton
2017-06-05 13:32 ` 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).