DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH] test/graph: fix memory leak
@ 2020-05-14  3:31 kirankumark
  2020-05-14  7:59 ` Jerin Jacob
  2020-05-14  9:07 ` [dpdk-dev] [PATCH v2] " kirankumark
  0 siblings, 2 replies; 7+ messages in thread
From: kirankumark @ 2020-05-14  3:31 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram; +Cc: dev

From: Kiran Kumar K <kirankumark@marvell.com>

Fix memory leaks reported by coverity.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
 app/test/test_graph.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index cf6df0744..ed69eda99 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
 #include <rte_graph.h>
 #include <rte_graph_worker.h>
 #include <rte_mbuf.h>
+#include <rte_random.h>
 
 #include "test.h"
 
@@ -145,7 +146,7 @@ uint16_t
 test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
-	uint32_t obj_node0 = rand() % 100, obj_node1;
+	uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 	test_main_t *tm = &test_main;
 	struct rte_mbuf *data;
 	void **next_stream;
@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
 	test_main_t *tm = &test_main;
 
 	if (*(uint32_t *)node->ctx == test_node0.id) {
-		uint32_t obj_node0 = rand() % 100, obj_node1;
+		uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 		struct rte_mbuf *data;
 		uint8_t second_pass = 0;
 		uint32_t count = 0;
@@ -496,6 +497,7 @@ test_lookup_functions(void)
 			printf("Test number of edges for node = %s failed Expected = %d, got %d\n",
 			       tm->test_node[i].node.name,
 			       tm->test_node[i].node.nb_edges, count);
+			free(next_edges);
 			return -1;
 		}
 
@@ -505,6 +507,7 @@ test_lookup_functions(void)
 				printf("Edge name miss match, expected = %s got = %s\n",
 				       tm->test_node[i].node.next_nodes[j],
 				       next_edges[j]);
+				free(next_edges);
 				return -1;
 			}
 		}
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH] test/graph: fix memory leak
  2020-05-14  3:31 [dpdk-dev] [PATCH] test/graph: fix memory leak kirankumark
@ 2020-05-14  7:59 ` Jerin Jacob
  2020-05-14  9:07 ` [dpdk-dev] [PATCH v2] " kirankumark
  1 sibling, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2020-05-14  7:59 UTC (permalink / raw)
  To: Kiran Kumar K; +Cc: Jerin Jacob, Nithin Dabilpuram, dpdk-dev

On Thu, May 14, 2020 at 9:02 AM <kirankumark@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Fix memory leaks reported by coverity.

Please add Coverity issue:  and Fixes: tag


>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> ---
>  app/test/test_graph.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test_graph.c b/app/test/test_graph.c
> index cf6df0744..ed69eda99 100644
> --- a/app/test/test_graph.c
> +++ b/app/test/test_graph.c
> @@ -12,6 +12,7 @@
>  #include <rte_graph.h>
>  #include <rte_graph_worker.h>
>  #include <rte_mbuf.h>
> +#include <rte_random.h>
>
>  #include "test.h"
>
> @@ -145,7 +146,7 @@ uint16_t
>  test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
>                         void **objs, uint16_t nb_objs)
>  {
> -       uint32_t obj_node0 = rand() % 100, obj_node1;
> +       uint32_t obj_node0 = rte_rand() % 100, obj_node1;
>         test_main_t *tm = &test_main;
>         struct rte_mbuf *data;
>         void **next_stream;
> @@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
>         test_main_t *tm = &test_main;
>
>         if (*(uint32_t *)node->ctx == test_node0.id) {
> -               uint32_t obj_node0 = rand() % 100, obj_node1;
> +               uint32_t obj_node0 = rte_rand() % 100, obj_node1;
>                 struct rte_mbuf *data;
>                 uint8_t second_pass = 0;
>                 uint32_t count = 0;
> @@ -496,6 +497,7 @@ test_lookup_functions(void)
>                         printf("Test number of edges for node = %s failed Expected = %d, got %d\n",
>                                tm->test_node[i].node.name,
>                                tm->test_node[i].node.nb_edges, count);
> +                       free(next_edges);
>                         return -1;
>                 }
>
> @@ -505,6 +507,7 @@ test_lookup_functions(void)
>                                 printf("Edge name miss match, expected = %s got = %s\n",
>                                        tm->test_node[i].node.next_nodes[j],
>                                        next_edges[j]);
> +                               free(next_edges);
>                                 return -1;
>                         }
>                 }
> --
> 2.17.1
>

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

* [dpdk-dev]  [PATCH v2] test/graph: fix memory leak
  2020-05-14  3:31 [dpdk-dev] [PATCH] test/graph: fix memory leak kirankumark
  2020-05-14  7:59 ` Jerin Jacob
@ 2020-05-14  9:07 ` kirankumark
  2020-05-14 11:24   ` [dpdk-dev] [PATCH v3] test/graph: fix coverity issues kirankumark
  1 sibling, 1 reply; 7+ messages in thread
From: kirankumark @ 2020-05-14  9:07 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram; +Cc: dev

From: Kiran Kumar K <kirankumark@marvell.com>

Fix memory leaks reported by coverity.

Coverity issue: 358439, 358451, 358448.
Fixes: 6b89650418("test/graph: add functional tests")

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
V2 changes:
* Added Coverity issue and Fixes info.

 app/test/test_graph.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index cf6df0744..ed69eda99 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
 #include <rte_graph.h>
 #include <rte_graph_worker.h>
 #include <rte_mbuf.h>
+#include <rte_random.h>

 #include "test.h"

@@ -145,7 +146,7 @@ uint16_t
 test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
-	uint32_t obj_node0 = rand() % 100, obj_node1;
+	uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 	test_main_t *tm = &test_main;
 	struct rte_mbuf *data;
 	void **next_stream;
@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
 	test_main_t *tm = &test_main;

 	if (*(uint32_t *)node->ctx == test_node0.id) {
-		uint32_t obj_node0 = rand() % 100, obj_node1;
+		uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 		struct rte_mbuf *data;
 		uint8_t second_pass = 0;
 		uint32_t count = 0;
@@ -496,6 +497,7 @@ test_lookup_functions(void)
 			printf("Test number of edges for node = %s failed Expected = %d, got %d\n",
 			       tm->test_node[i].node.name,
 			       tm->test_node[i].node.nb_edges, count);
+			free(next_edges);
 			return -1;
 		}

@@ -505,6 +507,7 @@ test_lookup_functions(void)
 				printf("Edge name miss match, expected = %s got = %s\n",
 				       tm->test_node[i].node.next_nodes[j],
 				       next_edges[j]);
+				free(next_edges);
 				return -1;
 			}
 		}
--
2.17.1


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

* [dpdk-dev]  [PATCH v3] test/graph: fix coverity issues
  2020-05-14  9:07 ` [dpdk-dev] [PATCH v2] " kirankumark
@ 2020-05-14 11:24   ` kirankumark
  2020-05-15  7:05     ` Jerin Jacob
  2020-05-15  7:28     ` [dpdk-dev] [PATCH v4] " kirankumark
  0 siblings, 2 replies; 7+ messages in thread
From: kirankumark @ 2020-05-14 11:24 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram; +Cc: dev

From: Kiran Kumar K <kirankumark@marvell.com>

Fix memory leak and weak crypto issues reported by coverity.

Coverity issue: 358439, 358448, 358451
Fixes: 6b89650418("test/graph: add functional tests")

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
---
 app/test/test_graph.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index cf6df0744..ed69eda99 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
 #include <rte_graph.h>
 #include <rte_graph_worker.h>
 #include <rte_mbuf.h>
+#include <rte_random.h>
 
 #include "test.h"
 
@@ -145,7 +146,7 @@ uint16_t
 test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
-	uint32_t obj_node0 = rand() % 100, obj_node1;
+	uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 	test_main_t *tm = &test_main;
 	struct rte_mbuf *data;
 	void **next_stream;
@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
 	test_main_t *tm = &test_main;
 
 	if (*(uint32_t *)node->ctx == test_node0.id) {
-		uint32_t obj_node0 = rand() % 100, obj_node1;
+		uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 		struct rte_mbuf *data;
 		uint8_t second_pass = 0;
 		uint32_t count = 0;
@@ -496,6 +497,7 @@ test_lookup_functions(void)
 			printf("Test number of edges for node = %s failed Expected = %d, got %d\n",
 			       tm->test_node[i].node.name,
 			       tm->test_node[i].node.nb_edges, count);
+			free(next_edges);
 			return -1;
 		}
 
@@ -505,6 +507,7 @@ test_lookup_functions(void)
 				printf("Edge name miss match, expected = %s got = %s\n",
 				       tm->test_node[i].node.next_nodes[j],
 				       next_edges[j]);
+				free(next_edges);
 				return -1;
 			}
 		}
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH v3] test/graph: fix coverity issues
  2020-05-14 11:24   ` [dpdk-dev] [PATCH v3] test/graph: fix coverity issues kirankumark
@ 2020-05-15  7:05     ` Jerin Jacob
  2020-05-15  7:28     ` [dpdk-dev] [PATCH v4] " kirankumark
  1 sibling, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2020-05-15  7:05 UTC (permalink / raw)
  To: Kiran Kumar K, David Marchand; +Cc: Jerin Jacob, Nithin Dabilpuram, dpdk-dev

On Thu, May 14, 2020 at 4:56 PM <kirankumark@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Fix memory leak and weak crypto issues reported by coverity.
>
> Coverity issue: 358439, 358448, 358451
> Fixes: 6b89650418("test/graph: add functional tests")

Space is missing before the opening bracket due to that checkpatch is failing.

With above change:
Acked-by: Jerin Jacob <jerinj@marvell.com>



>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> ---
>  app/test/test_graph.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test_graph.c b/app/test/test_graph.c
> index cf6df0744..ed69eda99 100644
> --- a/app/test/test_graph.c
> +++ b/app/test/test_graph.c
> @@ -12,6 +12,7 @@
>  #include <rte_graph.h>
>  #include <rte_graph_worker.h>
>  #include <rte_mbuf.h>
> +#include <rte_random.h>
>
>  #include "test.h"
>
> @@ -145,7 +146,7 @@ uint16_t
>  test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
>                         void **objs, uint16_t nb_objs)
>  {
> -       uint32_t obj_node0 = rand() % 100, obj_node1;
> +       uint32_t obj_node0 = rte_rand() % 100, obj_node1;
>         test_main_t *tm = &test_main;
>         struct rte_mbuf *data;
>         void **next_stream;
> @@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
>         test_main_t *tm = &test_main;
>
>         if (*(uint32_t *)node->ctx == test_node0.id) {
> -               uint32_t obj_node0 = rand() % 100, obj_node1;
> +               uint32_t obj_node0 = rte_rand() % 100, obj_node1;
>                 struct rte_mbuf *data;
>                 uint8_t second_pass = 0;
>                 uint32_t count = 0;
> @@ -496,6 +497,7 @@ test_lookup_functions(void)
>                         printf("Test number of edges for node = %s failed Expected = %d, got %d\n",
>                                tm->test_node[i].node.name,
>                                tm->test_node[i].node.nb_edges, count);
> +                       free(next_edges);
>                         return -1;
>                 }
>
> @@ -505,6 +507,7 @@ test_lookup_functions(void)
>                                 printf("Edge name miss match, expected = %s got = %s\n",
>                                        tm->test_node[i].node.next_nodes[j],
>                                        next_edges[j]);
> +                               free(next_edges);
>                                 return -1;
>                         }
>                 }
> --
> 2.17.1
>

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

* [dpdk-dev]  [PATCH v4] test/graph: fix coverity issues
  2020-05-14 11:24   ` [dpdk-dev] [PATCH v3] test/graph: fix coverity issues kirankumark
  2020-05-15  7:05     ` Jerin Jacob
@ 2020-05-15  7:28     ` kirankumark
  2020-05-15  8:14       ` David Marchand
  1 sibling, 1 reply; 7+ messages in thread
From: kirankumark @ 2020-05-15  7:28 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar K, Nithin Dabilpuram; +Cc: dev

From: Kiran Kumar K <kirankumark@marvell.com>

Fix memory leak and weak crypto issues reported by coverity.

Coverity issue: 358439, 358448, 358451
Fixes: 6b89650418 ("test/graph: add functional tests")

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
---
V4 Changes:
* Added space before bracket in Fixes.

 app/test/test_graph.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index cf6df0744..ed69eda99 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -12,6 +12,7 @@
 #include <rte_graph.h>
 #include <rte_graph_worker.h>
 #include <rte_mbuf.h>
+#include <rte_random.h>

 #include "test.h"

@@ -145,7 +146,7 @@ uint16_t
 test_node_worker_source(struct rte_graph *graph, struct rte_node *node,
 			void **objs, uint16_t nb_objs)
 {
-	uint32_t obj_node0 = rand() % 100, obj_node1;
+	uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 	test_main_t *tm = &test_main;
 	struct rte_mbuf *data;
 	void **next_stream;
@@ -193,7 +194,7 @@ test_node0_worker(struct rte_graph *graph, struct rte_node *node, void **objs,
 	test_main_t *tm = &test_main;

 	if (*(uint32_t *)node->ctx == test_node0.id) {
-		uint32_t obj_node0 = rand() % 100, obj_node1;
+		uint32_t obj_node0 = rte_rand() % 100, obj_node1;
 		struct rte_mbuf *data;
 		uint8_t second_pass = 0;
 		uint32_t count = 0;
@@ -496,6 +497,7 @@ test_lookup_functions(void)
 			printf("Test number of edges for node = %s failed Expected = %d, got %d\n",
 			       tm->test_node[i].node.name,
 			       tm->test_node[i].node.nb_edges, count);
+			free(next_edges);
 			return -1;
 		}

@@ -505,6 +507,7 @@ test_lookup_functions(void)
 				printf("Edge name miss match, expected = %s got = %s\n",
 				       tm->test_node[i].node.next_nodes[j],
 				       next_edges[j]);
+				free(next_edges);
 				return -1;
 			}
 		}
--
2.17.1


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

* Re: [dpdk-dev] [PATCH v4] test/graph: fix coverity issues
  2020-05-15  7:28     ` [dpdk-dev] [PATCH v4] " kirankumark
@ 2020-05-15  8:14       ` David Marchand
  0 siblings, 0 replies; 7+ messages in thread
From: David Marchand @ 2020-05-15  8:14 UTC (permalink / raw)
  To: Kiran Kumar Kokkilagadda; +Cc: Jerin Jacob, Nithin Dabilpuram, dev

On Fri, May 15, 2020 at 9:29 AM <kirankumark@marvell.com> wrote:
>
> From: Kiran Kumar K <kirankumark@marvell.com>
>
> Fix memory leak and weak crypto issues reported by coverity.
>
> Coverity issue: 358439, 358448, 358451
> Fixes: 6b89650418 ("test/graph: add functional tests")
>
> Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> Acked-by: Jerin Jacob <jerinj@marvell.com>

Applied, thanks.


-- 
David Marchand


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

end of thread, other threads:[~2020-05-15  8:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  3:31 [dpdk-dev] [PATCH] test/graph: fix memory leak kirankumark
2020-05-14  7:59 ` Jerin Jacob
2020-05-14  9:07 ` [dpdk-dev] [PATCH v2] " kirankumark
2020-05-14 11:24   ` [dpdk-dev] [PATCH v3] test/graph: fix coverity issues kirankumark
2020-05-15  7:05     ` Jerin Jacob
2020-05-15  7:28     ` [dpdk-dev] [PATCH v4] " kirankumark
2020-05-15  8:14       ` David Marchand

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