patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] net/cpfl: fix memory leak
@ 2023-10-17 11:06 beilei.xing
  2023-10-18  2:05 ` Zhang, Qi Z
  2023-10-18 14:27 ` [PATCH v2] " beilei.xing
  0 siblings, 2 replies; 4+ messages in thread
From: beilei.xing @ 2023-10-17 11:06 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Beilei Xing, stable

From: Beilei Xing <beilei.xing@intel.com>

Fix resource leak reported in coverity scan.

Coverity issue: 403265
Fixes: 2d823ecd671c ("net/cpfl: support device initialization")
Fixes: 989465ac51ea ("net/cpfl: support probe again")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/cpfl/cpfl_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index 890a027a1d..0093deab5a 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1626,7 +1626,8 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
 
 	if (rte_kvargs_count(kvlist, CPFL_VPORT) > 1) {
 		PMD_INIT_LOG(ERR, "devarg vport is duplicated.");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto fail;
 	}
 
 	ret = rte_kvargs_process(kvlist, CPFL_REPRESENTOR, &parse_repr, cpfl_args);
@@ -1635,7 +1636,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
 		goto fail;
 
 	if (!first)
-		return 0;
+		goto fail;
 
 	ret = rte_kvargs_process(kvlist, CPFL_VPORT, &parse_vport,
 				 cpfl_args);
-- 
2.34.1


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

* RE: [PATCH] net/cpfl: fix memory leak
  2023-10-17 11:06 [PATCH] net/cpfl: fix memory leak beilei.xing
@ 2023-10-18  2:05 ` Zhang, Qi Z
  2023-10-18 14:27 ` [PATCH v2] " beilei.xing
  1 sibling, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2023-10-18  2:05 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Jingjing; +Cc: dev, Xing, Beilei, stable



> -----Original Message-----
> From: beilei.xing@intel.com <beilei.xing@intel.com>
> Sent: Tuesday, October 17, 2023 7:07 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: [PATCH] net/cpfl: fix memory leak
>
> From: Beilei Xing <beilei.xing@intel.com>
>
> Fix resource leak reported in coverity scan.
>
> Coverity issue: 403265
> Fixes: 2d823ecd671c ("net/cpfl: support device initialization")
> Fixes: 989465ac51ea ("net/cpfl: support probe again")
> Cc: stable@dpdk.org
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>
> ---
>  drivers/net/cpfl/cpfl_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
> index 890a027a1d..0093deab5a 100644
> --- a/drivers/net/cpfl/cpfl_ethdev.c
> +++ b/drivers/net/cpfl/cpfl_ethdev.c
> @@ -1626,7 +1626,8 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev,
> struct cpfl_adapter_ext *adap
>
>       if (rte_kvargs_count(kvlist, CPFL_VPORT) > 1) {
>               PMD_INIT_LOG(ERR, "devarg vport is duplicated.");
> -             return -EINVAL;
> +             ret = -EINVAL;
> +             goto fail;
>       }
>
>       ret = rte_kvargs_process(kvlist, CPFL_REPRESENTOR, &parse_repr,
> cpfl_args); @@ -1635,7 +1636,7 @@ cpfl_parse_devargs(struct
> rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
>               goto fail;
>
>       if (!first)
> -             return 0;
> +             goto fail;

goto fail in a success case cause confusion, maybe we can rename "fail" as "finish", or adding a another label right before "fail"?
>
>       ret = rte_kvargs_process(kvlist, CPFL_VPORT, &parse_vport,
>                                cpfl_args);
> --
> 2.34.1


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

* [PATCH v2] net/cpfl: fix memory leak
  2023-10-17 11:06 [PATCH] net/cpfl: fix memory leak beilei.xing
  2023-10-18  2:05 ` Zhang, Qi Z
@ 2023-10-18 14:27 ` beilei.xing
  2023-10-19  1:16   ` Zhang, Qi Z
  1 sibling, 1 reply; 4+ messages in thread
From: beilei.xing @ 2023-10-18 14:27 UTC (permalink / raw)
  To: jingjing.wu, yuying.zhang; +Cc: dev, Beilei Xing, stable

From: Beilei Xing <beilei.xing@intel.com>

Fix resource leak reported in coverity scan.

Coverity issue: 403265
Fixes: 2d823ecd671c ("net/cpfl: support device initialization")
Fixes: 989465ac51ea ("net/cpfl: support probe again")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
v2 change:
 - add label finish for successful case.

 drivers/net/cpfl/cpfl_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index 890a027a1d..a94a0604f5 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -1626,7 +1626,8 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
 
 	if (rte_kvargs_count(kvlist, CPFL_VPORT) > 1) {
 		PMD_INIT_LOG(ERR, "devarg vport is duplicated.");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto fail;
 	}
 
 	ret = rte_kvargs_process(kvlist, CPFL_REPRESENTOR, &parse_repr, cpfl_args);
@@ -1635,7 +1636,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
 		goto fail;
 
 	if (!first)
-		return 0;
+		goto finish;
 
 	ret = rte_kvargs_process(kvlist, CPFL_VPORT, &parse_vport,
 				 cpfl_args);
@@ -1663,6 +1664,7 @@ cpfl_parse_devargs(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *adap
 		cpfl_args->flow_parser[0] = '\0';
 	}
 #endif
+finish:
 fail:
 	rte_kvargs_free(kvlist);
 	return ret;
-- 
2.34.1


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

* RE: [PATCH v2] net/cpfl: fix memory leak
  2023-10-18 14:27 ` [PATCH v2] " beilei.xing
@ 2023-10-19  1:16   ` Zhang, Qi Z
  0 siblings, 0 replies; 4+ messages in thread
From: Zhang, Qi Z @ 2023-10-19  1:16 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Jingjing, Zhang, Yuying; +Cc: dev, Xing, Beilei, stable



> -----Original Message-----
> From: beilei.xing@intel.com <beilei.xing@intel.com>
> Sent: Wednesday, October 18, 2023 10:27 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>; Zhang, Yuying
> <yuying.zhang@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/cpfl: fix memory leak
>
> From: Beilei Xing <beilei.xing@intel.com>
>
> Fix resource leak reported in coverity scan.
>
> Coverity issue: 403265
> Fixes: 2d823ecd671c ("net/cpfl: support device initialization")
> Fixes: 989465ac51ea ("net/cpfl: support probe again")
> Cc: stable@dpdk.org
>
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2023-10-19  1:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 11:06 [PATCH] net/cpfl: fix memory leak beilei.xing
2023-10-18  2:05 ` Zhang, Qi Z
2023-10-18 14:27 ` [PATCH v2] " beilei.xing
2023-10-19  1:16   ` Zhang, Qi Z

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