DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue
@ 2020-05-07  9:08 Kalesh A P
  2020-05-07  9:48 ` Iremonger, Bernard
  2020-05-07 11:06 ` [dpdk-dev] [PATCH v2] app/testpmd: fix null " Kalesh A P
  0 siblings, 2 replies; 8+ messages in thread
From: Kalesh A P @ 2020-05-07  9:08 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, beilei.xing, jingjing.wu, bernard.iremonger

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Note that the issue was observed in an internal Coverity scan.

Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP profiles")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
 app/test-pmd/cmdline.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b040630..996a498 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(
 #ifdef RTE_LIBRTE_I40E_PMD
 	size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
 	p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
-	if (!p_list)
+	if (!p_list) {
 		printf("%s: Failed to malloc buffer\n", __func__);
+		return;
+	}
 
 	if (ret == -ENOTSUP)
 		ret = rte_pmd_i40e_get_ddp_list(res->port_id,
-- 
2.10.1


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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue
  2020-05-07  9:08 [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue Kalesh A P
@ 2020-05-07  9:48 ` Iremonger, Bernard
  2020-05-07 10:32   ` Kalesh Anakkur Purayil
  2020-05-07 11:06 ` [dpdk-dev] [PATCH v2] app/testpmd: fix null " Kalesh A P
  1 sibling, 1 reply; 8+ messages in thread
From: Iremonger, Bernard @ 2020-05-07  9:48 UTC (permalink / raw)
  To: Kalesh A P, dev; +Cc: Yigit, Ferruh, Xing, Beilei, Wu, Jingjing

Hi Kalesh,

> -----Original Message-----
> From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
> Sent: Thursday, May 7, 2020 10:08 AM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Iremonger,
> Bernard <bernard.iremonger@intel.com>
> Subject: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing
> issue
> 
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> Note that the issue was observed in an internal Coverity scan.
> 
> Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP
> profiles")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> ---
>  app/test-pmd/cmdline.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> b040630..996a498 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(  #ifdef
> RTE_LIBRTE_I40E_PMD
>  	size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
>  	p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
> -	if (!p_list)
> +	if (!p_list) {
>  		printf("%s: Failed to malloc buffer\n", __func__);
> +		return;
> +	}
> 
>  	if (ret == -ENOTSUP)
>  		ret = rte_pmd_i40e_get_ddp_list(res->port_id,
> --
> 2.10.1

./devtools/check-git-log.sh -1
Wrong headline case:
"app/testpmd: fix NULL pointer dereferencing issue": NULL --> null
Missing 'Coverity issue:' tag:
        app/testpmd: fix NULL pointer dereferencing issue

Regards,

Bernard.

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue
  2020-05-07  9:48 ` Iremonger, Bernard
@ 2020-05-07 10:32   ` Kalesh Anakkur Purayil
  2020-05-07 10:43     ` Iremonger, Bernard
  0 siblings, 1 reply; 8+ messages in thread
From: Kalesh Anakkur Purayil @ 2020-05-07 10:32 UTC (permalink / raw)
  To: Iremonger, Bernard; +Cc: dev, Yigit, Ferruh, Xing, Beilei, Wu, Jingjing

Hi Bernard,

On Thu, May 7, 2020 at 3:18 PM Iremonger, Bernard <
bernard.iremonger@intel.com> wrote:

> Hi Kalesh,
>
> > -----Original Message-----
> > From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
> > Sent: Thursday, May 7, 2020 10:08 AM
> > To: dev@dpdk.org
> > Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>;
> Iremonger,
> > Bernard <bernard.iremonger@intel.com>
> > Subject: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing
> > issue
> >
> > From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> >
> > Note that the issue was observed in an internal Coverity scan.
> >
> > Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP
> > profiles")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> > ---
> >  app/test-pmd/cmdline.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > b040630..996a498 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(  #ifdef
> > RTE_LIBRTE_I40E_PMD
> >       size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
> >       p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
> > -     if (!p_list)
> > +     if (!p_list) {
> >               printf("%s: Failed to malloc buffer\n", __func__);
> > +             return;
> > +     }
> >
> >       if (ret == -ENOTSUP)
> >               ret = rte_pmd_i40e_get_ddp_list(res->port_id,
> > --
> > 2.10.1
>
> ./devtools/check-git-log.sh -1
> Wrong headline case:
> "app/testpmd: fix NULL pointer dereferencing issue": NULL --> null
>
[Kalesh]: will fix it.

> Missing 'Coverity issue:' tag:
>         app/testpmd: fix NULL pointer dereferencing issue
>
[Kalesh]:  This was found in an internal scan. So there is no Coverity
issue tag for this.

>
> Regards,
>
> Bernard.
>


-- 
Regards,
Kalesh A P

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

* Re: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue
  2020-05-07 10:32   ` Kalesh Anakkur Purayil
@ 2020-05-07 10:43     ` Iremonger, Bernard
  0 siblings, 0 replies; 8+ messages in thread
From: Iremonger, Bernard @ 2020-05-07 10:43 UTC (permalink / raw)
  To: Kalesh Anakkur Purayil; +Cc: dev, Yigit, Ferruh, Xing, Beilei, Wu, Jingjing

Hi Kalesh,

From: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Sent: Thursday, May 7, 2020 11:33 AM
To: Iremonger, Bernard <bernard.iremonger@intel.com>
Cc: dev@dpdk.org; Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue

Hi Bernard,

On Thu, May 7, 2020 at 3:18 PM Iremonger, Bernard <bernard.iremonger@intel.com<mailto:bernard.iremonger@intel.com>> wrote:
Hi Kalesh,

> -----Original Message-----
> From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com<mailto:kalesh-anakkur.purayil@broadcom.com>>
> Sent: Thursday, May 7, 2020 10:08 AM
> To: dev@dpdk.org<mailto:dev@dpdk.org>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com<mailto:ferruh.yigit@intel.com>>; Xing, Beilei
> <beilei.xing@intel.com<mailto:beilei.xing@intel.com>>; Wu, Jingjing <jingjing.wu@intel.com<mailto:jingjing.wu@intel.com>>; Iremonger,
> Bernard <bernard.iremonger@intel.com<mailto:bernard.iremonger@intel.com>>
> Subject: [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing
> issue
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com<mailto:kalesh-anakkur.purayil@broadcom.com>>
>
> Note that the issue was observed in an internal Coverity scan.
>
> Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP
> profiles")
> Cc: stable@dpdk.org<mailto:stable@dpdk.org>
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com<mailto:kalesh-anakkur.purayil@broadcom.com>>
> ---
>  app/test-pmd/cmdline.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> b040630..996a498 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(  #ifdef
> RTE_LIBRTE_I40E_PMD
>       size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
>       p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
> -     if (!p_list)
> +     if (!p_list) {
>               printf("%s: Failed to malloc buffer\n", __func__);
> +             return;
> +     }
>
>       if (ret == -ENOTSUP)
>               ret = rte_pmd_i40e_get_ddp_list(res->port_id,
> --
> 2.10.1

./devtools/check-git-log.sh -1
Wrong headline case:
"app/testpmd: fix NULL pointer dereferencing issue": NULL --> null
[Kalesh]: will fix it.
Missing 'Coverity issue:' tag:
        app/testpmd: fix NULL pointer dereferencing issue
[Kalesh]:  This was found in an internal scan. So there is no Coverity issue tag for this.

If there is no Coverity issue tag for this bug, then best not to mention Coverity in the commit message.
An explanation of the fix should be added to the commit message.

Regards,

Bernard.


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

* [dpdk-dev] [PATCH v2] app/testpmd: fix null pointer dereferencing issue
  2020-05-07  9:08 [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue Kalesh A P
  2020-05-07  9:48 ` Iremonger, Bernard
@ 2020-05-07 11:06 ` Kalesh A P
  2020-05-07 13:21   ` Iremonger, Bernard
  2020-05-08  4:50   ` [dpdk-dev] [PATCH v3] " Kalesh A P
  1 sibling, 2 replies; 8+ messages in thread
From: Kalesh A P @ 2020-05-07 11:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, beilei.xing, jingjing.wu, bernard.iremonger

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

Note that the issue was observed in an internal Coverity scan.

Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP profiles")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
---
v2: fixed headline case

 app/test-pmd/cmdline.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b040630..996a498 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(
 #ifdef RTE_LIBRTE_I40E_PMD
 	size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
 	p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
-	if (!p_list)
+	if (!p_list) {
 		printf("%s: Failed to malloc buffer\n", __func__);
+		return;
+	}
 
 	if (ret == -ENOTSUP)
 		ret = rte_pmd_i40e_get_ddp_list(res->port_id,
-- 
2.10.1


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

* Re: [dpdk-dev] [PATCH v2] app/testpmd: fix null pointer dereferencing issue
  2020-05-07 11:06 ` [dpdk-dev] [PATCH v2] app/testpmd: fix null " Kalesh A P
@ 2020-05-07 13:21   ` Iremonger, Bernard
  2020-05-08  4:50   ` [dpdk-dev] [PATCH v3] " Kalesh A P
  1 sibling, 0 replies; 8+ messages in thread
From: Iremonger, Bernard @ 2020-05-07 13:21 UTC (permalink / raw)
  To: Kalesh A P, dev; +Cc: Yigit, Ferruh, Xing, Beilei, Wu, Jingjing

Hi Kalesh,

> -----Original Message-----
> From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
> Sent: Thursday, May 7, 2020 12:06 PM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Iremonger,
> Bernard <bernard.iremonger@intel.com>
> Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix null pointer dereferencing
> issue
> 
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> Note that the issue was observed in an internal Coverity scan.
> 
> Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP
> profiles")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> ---
> v2: fixed headline case
> 
>  app/test-pmd/cmdline.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> b040630..996a498 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(  #ifdef
> RTE_LIBRTE_I40E_PMD
>  	size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
>  	p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
> -	if (!p_list)
> +	if (!p_list) {
>  		printf("%s: Failed to malloc buffer\n", __func__);
> +		return;
> +	}
> 
>  	if (ret == -ENOTSUP)
>  		ret = rte_pmd_i40e_get_ddp_list(res->port_id,
> --
> 2.10.1

./devtools/check-git-log.sh 
Missing 'Coverity issue:' tag:
        app/testpmd: fix null pointer dereferencing issue

As there is no Coverity issue tag for this bug, then best not to mention Coverity in the commit message.
An explanation of the fix should be added to the commit message.
How the bug was found is not relevant to the commit message.

Otherwise

Acked-by Bernard Iremonger <bernard.iremonger@intel.com>

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

* [dpdk-dev] [PATCH v3] app/testpmd: fix null pointer dereferencing issue
  2020-05-07 11:06 ` [dpdk-dev] [PATCH v2] app/testpmd: fix null " Kalesh A P
  2020-05-07 13:21   ` Iremonger, Bernard
@ 2020-05-08  4:50   ` Kalesh A P
  2020-05-08 15:13     ` Ferruh Yigit
  1 sibling, 1 reply; 8+ messages in thread
From: Kalesh A P @ 2020-05-08  4:50 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, beilei.xing, jingjing.wu, bernard.iremonger

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In cmd_ddp_get_list_parsed(), elements of "p_list" are accessed
even after the memory allocation for "p_list" fails.

With this patch, this null pointer dereference is avoided as we
return when there is malloc failure.

Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP profiles")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
v3: fixed commit message as suggested by Bernard Iremonger
v2: fixed headline case

 app/test-pmd/cmdline.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index b040630..996a498 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -16891,8 +16891,10 @@ cmd_ddp_get_list_parsed(
 #ifdef RTE_LIBRTE_I40E_PMD
 	size = PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4;
 	p_list = (struct rte_pmd_i40e_profile_list *)malloc(size);
-	if (!p_list)
+	if (!p_list) {
 		printf("%s: Failed to malloc buffer\n", __func__);
+		return;
+	}
 
 	if (ret == -ENOTSUP)
 		ret = rte_pmd_i40e_get_ddp_list(res->port_id,
-- 
2.10.1


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

* Re: [dpdk-dev] [PATCH v3] app/testpmd: fix null pointer dereferencing issue
  2020-05-08  4:50   ` [dpdk-dev] [PATCH v3] " Kalesh A P
@ 2020-05-08 15:13     ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-05-08 15:13 UTC (permalink / raw)
  To: Kalesh A P, dev; +Cc: beilei.xing, jingjing.wu, bernard.iremonger

On 5/8/2020 5:50 AM, Kalesh A P wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> In cmd_ddp_get_list_parsed(), elements of "p_list" are accessed
> even after the memory allocation for "p_list" fails.
> 
> With this patch, this null pointer dereference is avoided as we
> return when there is malloc failure.
> 
> Fixes: e088907bb851 ("app/testpmd: add command for getting loaded DDP profiles")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>

Applied to dpdk-next-net/master, thanks.

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07  9:08 [dpdk-dev] [PATCH] app/testpmd: fix NULL pointer dereferencing issue Kalesh A P
2020-05-07  9:48 ` Iremonger, Bernard
2020-05-07 10:32   ` Kalesh Anakkur Purayil
2020-05-07 10:43     ` Iremonger, Bernard
2020-05-07 11:06 ` [dpdk-dev] [PATCH v2] app/testpmd: fix null " Kalesh A P
2020-05-07 13:21   ` Iremonger, Bernard
2020-05-08  4:50   ` [dpdk-dev] [PATCH v3] " Kalesh A P
2020-05-08 15:13     ` Ferruh Yigit

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