DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] graph: fix memory leak in node clone
@ 2024-10-30 12:12 pbhagavatula
  2024-11-01  1:27 ` Huichao cai
  2024-11-01  7:37 ` [PATCH v2] " pbhagavatula
  0 siblings, 2 replies; 6+ messages in thread
From: pbhagavatula @ 2024-10-30 12:12 UTC (permalink / raw)
  To: jerinj, Kiran Kumar K, Nithin Dabilpuram, Zhirun Yan; +Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Free memory allocated for the node when xstats memory
allocation fails.

Coverity issue: 445529
Fixes: 070db97e017b ("graph: support node xstats")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/graph/node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/graph/node.c b/lib/graph/node.c
index f15922892e..eb685b409f 100644
--- a/lib/graph/node.c
+++ b/lib/graph/node.c
@@ -156,7 +156,7 @@ node_clone(struct node *node, const char *name)
 				     (node->xstats->nb_xstats * RTE_NODE_XSTAT_DESC_SIZE));
 		if (reg->xstats == NULL) {
 			rte_errno = ENOMEM;
-			goto fail;
+			goto free;
 		}
 
 		for (i = 0; i < node->xstats->nb_xstats; i++)
-- 
2.25.1


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

* Re: [PATCH] graph: fix memory leak in node clone
  2024-10-30 12:12 [PATCH] graph: fix memory leak in node clone pbhagavatula
@ 2024-11-01  1:27 ` Huichao cai
  2024-11-01  7:37 ` [PATCH v2] " pbhagavatula
  1 sibling, 0 replies; 6+ messages in thread
From: Huichao cai @ 2024-11-01  1:27 UTC (permalink / raw)
  To: pbhagavatula; +Cc: dev, jerinj, kirankumark, ndabilpuram, yanzhirun_163

There is one more place in the node_clone function that needs to be modified:
       if (clone_name(reg->name, node->name, name))
                //goto free;
                goto free_xstat;


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

* [PATCH v2] graph: fix memory leak in node clone
  2024-10-30 12:12 [PATCH] graph: fix memory leak in node clone pbhagavatula
  2024-11-01  1:27 ` Huichao cai
@ 2024-11-01  7:37 ` pbhagavatula
  2024-11-05 13:28   ` David Marchand
  2024-11-05 13:34   ` Kiran Kumar Kokkilagadda
  1 sibling, 2 replies; 6+ messages in thread
From: pbhagavatula @ 2024-11-01  7:37 UTC (permalink / raw)
  To: jerinj, chcchc88, Kiran Kumar K, Nithin Dabilpuram, Zhirun Yan
  Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Free memory allocated for the node when xstats memory
allocation fails.

Coverity issue: 445529
Fixes: 070db97e017b ("graph: support node xstats")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
v2 Changes:
- Fix one more leak. (Huichao cai)

 lib/graph/node.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/graph/node.c b/lib/graph/node.c
index f15922892e..63db629da8 100644
--- a/lib/graph/node.c
+++ b/lib/graph/node.c
@@ -156,7 +156,7 @@ node_clone(struct node *node, const char *name)
 				     (node->xstats->nb_xstats * RTE_NODE_XSTAT_DESC_SIZE));
 		if (reg->xstats == NULL) {
 			rte_errno = ENOMEM;
-			goto fail;
+			goto free;
 		}

 		for (i = 0; i < node->xstats->nb_xstats; i++)
@@ -178,7 +178,7 @@ node_clone(struct node *node, const char *name)

 	/* Naming ceremony of the new node. name is node->name + "-" + name */
 	if (clone_name(reg->name, node->name, name))
-		goto free;
+		goto free_xstat;

 	rc = __rte_node_register(reg);
 free_xstat:
--
2.25.1


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

* Re: [PATCH v2] graph: fix memory leak in node clone
  2024-11-01  7:37 ` [PATCH v2] " pbhagavatula
@ 2024-11-05 13:28   ` David Marchand
  2024-11-06 20:21     ` David Marchand
  2024-11-05 13:34   ` Kiran Kumar Kokkilagadda
  1 sibling, 1 reply; 6+ messages in thread
From: David Marchand @ 2024-11-05 13:28 UTC (permalink / raw)
  To: pbhagavatula, chcchc88
  Cc: jerinj, Kiran Kumar K, Nithin Dabilpuram, Zhirun Yan, dev

On Fri, Nov 1, 2024 at 8:54 AM <pbhagavatula@marvell.com> wrote:
>
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
>
> Free memory allocated for the node when xstats memory
> allocation fails.
>
> Coverity issue: 445529
> Fixes: 070db97e017b ("graph: support node xstats")
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>

Huichao, does this fix look good to you?


-- 
David Marchand


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

* RE: [PATCH v2] graph: fix memory leak in node clone
  2024-11-01  7:37 ` [PATCH v2] " pbhagavatula
  2024-11-05 13:28   ` David Marchand
@ 2024-11-05 13:34   ` Kiran Kumar Kokkilagadda
  1 sibling, 0 replies; 6+ messages in thread
From: Kiran Kumar Kokkilagadda @ 2024-11-05 13:34 UTC (permalink / raw)
  To: Pavan Nikhilesh Bhagavatula, Jerin Jacob, chcchc88,
	Nithin Kumar Dabilpuram, Zhirun Yan
  Cc: dev, Pavan Nikhilesh Bhagavatula



> -----Original Message-----
> From: pbhagavatula@marvell.com <pbhagavatula@marvell.com>
> Sent: Friday, November 1, 2024 1:08 PM
> To: Jerin Jacob <jerinj@marvell.com>; chcchc88@163.com; Kiran Kumar
> Kokkilagadda <kirankumark@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Zhirun Yan <yanzhirun_163@163.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh Bhagavatula
> <pbhagavatula@marvell.com>
> Subject: [PATCH v2] graph: fix memory leak in node clone
> 
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Free memory allocated for the node when xstats memory allocation fails.
> 
> Coverity issue: 445529
> Fixes: 070db97e017b ("graph: support node xstats")
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---

Acked-by: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>



> v2 Changes:
> - Fix one more leak. (Huichao cai)
> 
>  lib/graph/node.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/graph/node.c b/lib/graph/node.c index
> f15922892e..63db629da8 100644
> --- a/lib/graph/node.c
> +++ b/lib/graph/node.c
> @@ -156,7 +156,7 @@ node_clone(struct node *node, const char *name)
>  				     (node->xstats->nb_xstats *
> RTE_NODE_XSTAT_DESC_SIZE));
>  		if (reg->xstats == NULL) {
>  			rte_errno = ENOMEM;
> -			goto fail;
> +			goto free;
>  		}
> 
>  		for (i = 0; i < node->xstats->nb_xstats; i++) @@ -178,7 +178,7
> @@ node_clone(struct node *node, const char *name)
> 
>  	/* Naming ceremony of the new node. name is node->name + "-" +
> name */
>  	if (clone_name(reg->name, node->name, name))
> -		goto free;
> +		goto free_xstat;
> 
>  	rc = __rte_node_register(reg);
>  free_xstat:
> --
> 2.25.1


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

* Re: [PATCH v2] graph: fix memory leak in node clone
  2024-11-05 13:28   ` David Marchand
@ 2024-11-06 20:21     ` David Marchand
  0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2024-11-06 20:21 UTC (permalink / raw)
  To: pbhagavatula
  Cc: jerinj, Kiran Kumar K, Nithin Dabilpuram, Zhirun Yan, dev, chcchc88

On Tue, Nov 5, 2024 at 2:28 PM David Marchand <david.marchand@redhat.com> wrote:
> On Fri, Nov 1, 2024 at 8:54 AM <pbhagavatula@marvell.com> wrote:
> >
> > From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> >
> > Free memory allocated for the node when xstats memory
> > allocation fails.
> >
> > Coverity issue: 445529
> > Fixes: 070db97e017b ("graph: support node xstats")
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kiran Kumar Kokkilagadda <kirankumark@marvell.com>

Applied, thanks.


-- 
David Marchand


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

end of thread, other threads:[~2024-11-06 20:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-30 12:12 [PATCH] graph: fix memory leak in node clone pbhagavatula
2024-11-01  1:27 ` Huichao cai
2024-11-01  7:37 ` [PATCH v2] " pbhagavatula
2024-11-05 13:28   ` David Marchand
2024-11-06 20:21     ` David Marchand
2024-11-05 13:34   ` Kiran Kumar Kokkilagadda

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