* [dpdk-dev] [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
` (2 more replies)
0 siblings, 3 replies; 7+ 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] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
2019-09-10 7:30 [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue Agalya Babu RadhaKrishnan
@ 2019-09-10 7:41 ` Babu Radhakrishnan, AgalyaX
2019-10-03 8:43 ` Sachin Saxena
2019-10-03 8:40 ` Sachin Saxena
2019-10-31 16:18 ` David Marchand
2 siblings, 1 reply; 7+ 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] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
2019-09-10 7:30 [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue Agalya Babu RadhaKrishnan
2019-09-10 7:41 ` Babu Radhakrishnan, AgalyaX
@ 2019-10-03 8:40 ` Sachin Saxena
2019-10-31 16:18 ` David Marchand
2 siblings, 0 replies; 7+ messages in thread
From: Sachin Saxena @ 2019-10-03 8:40 UTC (permalink / raw)
To: Agalya Babu RadhaKrishnan, dev
Cc: reshma.pattan, Hemant Agrawal, jananeex.m.parthasarathy, stable
Acked-by: Sachin Saxena <sachin.saxena@nxp.com>
regards,
Sachin Saxena
> -----Original Message-----
> From: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
> Sent: Tuesday, September 10, 2019 1:01 PM
> To: dev@dpdk.org
> Cc: reshma.pattan@intel.com; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
> jananeex.m.parthasarathy@intel.com; Agalya Babu RadhaKrishnan
> <agalyax.babu.radhakrishnan@intel.com>; stable@dpdk.org
> Subject: [PATCH] bus/fslmc: fix for resource leak coverity issue
> Importance: High
>
> 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] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
2019-09-10 7:41 ` Babu Radhakrishnan, AgalyaX
@ 2019-10-03 8:43 ` Sachin Saxena
2019-10-24 19:17 ` David Marchand
0 siblings, 1 reply; 7+ messages in thread
From: Sachin Saxena @ 2019-10-03 8:43 UTC (permalink / raw)
To: Babu Radhakrishnan, AgalyaX, dev
Cc: Pattan, Reshma, Hemant Agrawal, Parthasarathy, JananeeX M, stable
> -----Original Message-----
> From: Babu Radhakrishnan, AgalyaX
> <agalyax.babu.radhakrishnan@intel.com>
> Sent: Tuesday, September 10, 2019 1:11 PM
> To: dev@dpdk.org
> Cc: Pattan, Reshma <reshma.pattan@intel.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
> Parthasarathy, JananeeX M <jananeex.m.parthasarathy@intel.com>;
> stable@dpdk.org
> Subject: RE: [PATCH] bus/fslmc: fix for resource leak coverity issue
> Importance: High
>
> 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
[Sachin Saxena] The purpose of this logic to confirm that one of the device name should match to supported list and as soon as one strncmp() matches the string it will return 0 and the control comes out of IF condition.
So, existing logic is correct.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
2019-10-03 8:43 ` Sachin Saxena
@ 2019-10-24 19:17 ` David Marchand
2019-10-31 11:16 ` Sachin Saxena
0 siblings, 1 reply; 7+ messages in thread
From: David Marchand @ 2019-10-24 19:17 UTC (permalink / raw)
To: Sachin Saxena
Cc: Babu Radhakrishnan, AgalyaX, dev, Pattan, Reshma, Hemant Agrawal,
Parthasarathy, JananeeX M, stable
On Thu, Oct 3, 2019 at 10:43 AM Sachin Saxena <sachin.saxena@nxp.com> wrote:
>
>
> > -----Original Message-----
> > From: Babu Radhakrishnan, AgalyaX
> > <agalyax.babu.radhakrishnan@intel.com>
> > Sent: Tuesday, September 10, 2019 1:11 PM
> > To: dev@dpdk.org
> > Cc: Pattan, Reshma <reshma.pattan@intel.com>; Hemant Agrawal
> > <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
> > Parthasarathy, JananeeX M <jananeex.m.parthasarathy@intel.com>;
> > stable@dpdk.org
> > Subject: RE: [PATCH] bus/fslmc: fix for resource leak coverity issue
> > Importance: High
> >
> > 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
> [Sachin Saxena] The purpose of this logic to confirm that one of the device name should match to supported list and as soon as one strncmp() matches the string it will return 0 and the control comes out of IF condition.
> So, existing logic is correct.
>
Should I understand this as a confirmation of the initial ACK?
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
2019-10-24 19:17 ` David Marchand
@ 2019-10-31 11:16 ` Sachin Saxena
0 siblings, 0 replies; 7+ messages in thread
From: Sachin Saxena @ 2019-10-31 11:16 UTC (permalink / raw)
To: David Marchand
Cc: Babu Radhakrishnan, AgalyaX, dev, Pattan, Reshma, Hemant Agrawal,
Parthasarathy, JananeeX M, stable
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, October 25, 2019 12:47 AM
> To: Sachin Saxena <sachin.saxena@nxp.com>
> Cc: Babu Radhakrishnan, AgalyaX <agalyax.babu.radhakrishnan@intel.com>;
> dev@dpdk.org; Pattan, Reshma <reshma.pattan@intel.com>; Hemant
> Agrawal <hemant.agrawal@nxp.com>; Parthasarathy, JananeeX M
> <jananeex.m.parthasarathy@intel.com>; stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
>
> On Thu, Oct 3, 2019 at 10:43 AM Sachin Saxena <sachin.saxena@nxp.com>
> wrote:
> >
> >
> > > -----Original Message-----
> > > From: Babu Radhakrishnan, AgalyaX
> > > <agalyax.babu.radhakrishnan@intel.com>
> > > Sent: Tuesday, September 10, 2019 1:11 PM
> > > To: dev@dpdk.org
> > > Cc: Pattan, Reshma <reshma.pattan@intel.com>; Hemant Agrawal
> > > <hemant.agrawal@nxp.com>; Sachin Saxena <sachin.saxena@nxp.com>;
> > > Parthasarathy, JananeeX M <jananeex.m.parthasarathy@intel.com>;
> > > stable@dpdk.org
> > > Subject: RE: [PATCH] bus/fslmc: fix for resource leak coverity issue
> > > Importance: High
> > >
> > > 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
> > [Sachin Saxena] The purpose of this logic to confirm that one of the device
> name should match to supported list and as soon as one strncmp() matches
> the string it will return 0 and the control comes out of IF condition.
> > So, existing logic is correct.
> >
>
> Should I understand this as a confirmation of the initial ACK?
>
[Sachin Saxena] Yes. please consider it as ACK. Thank you.
>
> --
> David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue
2019-09-10 7:30 [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue Agalya Babu RadhaKrishnan
2019-09-10 7:41 ` Babu Radhakrishnan, AgalyaX
2019-10-03 8:40 ` Sachin Saxena
@ 2019-10-31 16:18 ` David Marchand
2 siblings, 0 replies; 7+ messages in thread
From: David Marchand @ 2019-10-31 16:18 UTC (permalink / raw)
To: Agalya Babu RadhaKrishnan
Cc: dev, Pattan, Reshma, Hemant Agrawal, Sachin Saxena,
Parthasarathy, JananeeX M, dpdk stable
On Tue, Sep 10, 2019 at 9:33 AM Agalya Babu RadhaKrishnan
<agalyax.babu.radhakrishnan@intel.com> wrote:
>
> 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
s/Issue/issue/ according to the contributing guide.
> Fixes: e67a61614d0b ("bus/fslmc: support device iteration")
> Cc: stable@dpdk.org
>
> Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Sachin Saxena <sachin.saxena@nxp.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-10-31 16:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 7:30 [dpdk-dev] [PATCH] bus/fslmc: fix for resource leak coverity issue Agalya Babu RadhaKrishnan
2019-09-10 7:41 ` Babu Radhakrishnan, AgalyaX
2019-10-03 8:43 ` Sachin Saxena
2019-10-24 19:17 ` David Marchand
2019-10-31 11:16 ` Sachin Saxena
2019-10-03 8:40 ` Sachin Saxena
2019-10-31 16:18 ` 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).