patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH] bus/fslmc: fix for resource leak coverity issue
@ 2019-09-10  7:30 Agalya Babu RadhaKrishnan
  2019-09-10  7:41 ` Babu Radhakrishnan, AgalyaX
  0 siblings, 1 reply; 2+ messages in thread
From: Agalya Babu RadhaKrishnan @ 2019-09-10  7:30 UTC (permalink / raw)
  To: dev
  Cc: reshma.pattan, hemant.agrawal, sachin.saxena,
	jananeex.m.parthasarathy, Agalya Babu RadhaKrishnan, stable

From: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>

1 issue caught by 344967
Leaked_storage: Variable sep going out of scope leaks the
storage it points to.

When 'sep' is not null and sep_exist is 0, 'sep' is freed
before going out of scope of the function irrespective of
'addr' exists or not.

Coverity Issue: 344967
Fixes: e67a61614d0b ("bus/fslmc: support device iteration")
Cc: stable@dpdk.org

Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index a2f482516..60c34098c 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -291,10 +291,13 @@ rte_fslmc_parse(const char *name, void *addr)
 		goto err_out;
 	}
 
-	if (addr)
+	if (addr) {
 		strcpy(addr, sep);
+		if (!sep_exists && sep)
+			free(sep);
+		return 0;
+	}
 
-	return 0;
 err_out:
 	if (!sep_exists && sep)
 		free(sep);
-- 
2.14.1


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

* Re: [dpdk-stable] [PATCH] bus/fslmc: fix for resource leak coverity issue
  2019-09-10  7:30 [dpdk-stable] [PATCH] bus/fslmc: fix for resource leak coverity issue Agalya Babu RadhaKrishnan
@ 2019-09-10  7:41 ` Babu Radhakrishnan, AgalyaX
  0 siblings, 0 replies; 2+ messages in thread
From: Babu Radhakrishnan, AgalyaX @ 2019-09-10  7:41 UTC (permalink / raw)
  To: dev
  Cc: Pattan, Reshma, hemant.agrawal, sachin.saxena, Parthasarathy,
	JananeeX M, stable

Hi,

> -----Original Message-----
> From: Babu Radhakrishnan, AgalyaX
> Sent: Tuesday, September 10, 2019 1:01 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma <reshma.pattan@intel.com>;
> hemant.agrawal@nxp.com; sachin.saxena@nxp.com; Parthasarathy,
> JananeeX M <jananeex.m.parthasarathy@intel.com>; Babu Radhakrishnan,
> AgalyaX <agalyax.babu.radhakrishnan@intel.com>; stable@dpdk.org
> Subject: [PATCH] bus/fslmc: fix for resource leak coverity issue
> 
> From: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
> 
> 1 issue caught by 344967
> Leaked_storage: Variable sep going out of scope leaks the storage it points
> to.
> 
> When 'sep' is not null and sep_exist is 0, 'sep' is freed before going out of
> scope of the function irrespective of 'addr' exists or not.
> 
> Coverity Issue: 344967
> Fixes: e67a61614d0b ("bus/fslmc: support device iteration")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Agalya Babu RadhaKrishnan
> <agalyax.babu.radhakrishnan@intel.com>
> ---

if (strncmp("dpni", sep, 4) &&
            strncmp("dpseci", sep, 6) &&
            strncmp("dpcon", sep, 5) &
            .....

We think validation of device name is done using AND operator instead it should be done by OR operator.
Please confirm.


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10  7:30 [dpdk-stable] [PATCH] bus/fslmc: fix for resource leak coverity issue Agalya Babu RadhaKrishnan
2019-09-10  7:41 ` Babu Radhakrishnan, AgalyaX

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox