DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] graph_stats: do not use a possibly NULL Pointer
@ 2021-05-24  8:58 Thierry Herbelot
  2021-05-24  9:23 ` Jerin Jacob
  2021-05-24  9:31 ` [dpdk-dev] [PATCH v2] graph: " Thierry Herbelot
  0 siblings, 2 replies; 4+ messages in thread
From: Thierry Herbelot @ 2021-05-24  8:58 UTC (permalink / raw)
  To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, stable, Jerin Jacob, Kiran Kumar K

Use stats only after it was checked not to be NULL.

Fixes: af1ae8b6a32c9 ("graph: implement stats")
Cc: stable@dpdk.org
Cc: Jerin Jacob <jerinj@marvell.com>
Cc: Kiran Kumar K <kirankumark@marvell.com>

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
---
 lib/graph/graph_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c
index 125e08d73290..a52994f0f61e 100644
--- a/lib/graph/graph_stats.c
+++ b/lib/graph/graph_stats.c
@@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster,
 	cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
 
 	stats = realloc(NULL, sz);
-	memset(stats, 0, sz);
 	if (stats) {
+		memset(stats, 0, sz);
 		stats->fn = fn;
 		stats->cluster_node_size = cluster_node_size;
 		stats->max_nodes = 0;
-- 
2.29.2


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

* Re: [dpdk-dev] [PATCH] graph_stats: do not use a possibly NULL Pointer
  2021-05-24  8:58 [dpdk-dev] [PATCH] graph_stats: do not use a possibly NULL Pointer Thierry Herbelot
@ 2021-05-24  9:23 ` Jerin Jacob
  2021-05-24  9:31 ` [dpdk-dev] [PATCH v2] graph: " Thierry Herbelot
  1 sibling, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2021-05-24  9:23 UTC (permalink / raw)
  To: Thierry Herbelot
  Cc: dpdk-dev, Thomas Monjalon, dpdk stable, Jerin Jacob, Kiran Kumar K

On Mon, May 24, 2021 at 2:28 PM Thierry Herbelot
<thierry.herbelot@6wind.com> wrote:
>
> Use stats only after it was checked not to be NULL.

Please change the subject to graph: ......

With the above fix:

Acked-by: Jerin Jacob <jerinj@marvell.com>

>
> Fixes: af1ae8b6a32c9 ("graph: implement stats")
> Cc: stable@dpdk.org
> Cc: Jerin Jacob <jerinj@marvell.com>
> Cc: Kiran Kumar K <kirankumark@marvell.com>
>
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> ---
>  lib/graph/graph_stats.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c
> index 125e08d73290..a52994f0f61e 100644
> --- a/lib/graph/graph_stats.c
> +++ b/lib/graph/graph_stats.c
> @@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster,
>         cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
>
>         stats = realloc(NULL, sz);
> -       memset(stats, 0, sz);
>         if (stats) {
> +               memset(stats, 0, sz);
>                 stats->fn = fn;
>                 stats->cluster_node_size = cluster_node_size;
>                 stats->max_nodes = 0;
> --
> 2.29.2
>

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

* [dpdk-dev] [PATCH v2] graph: do not use a possibly NULL Pointer
  2021-05-24  8:58 [dpdk-dev] [PATCH] graph_stats: do not use a possibly NULL Pointer Thierry Herbelot
  2021-05-24  9:23 ` Jerin Jacob
@ 2021-05-24  9:31 ` Thierry Herbelot
  2021-05-25  6:51   ` David Marchand
  1 sibling, 1 reply; 4+ messages in thread
From: Thierry Herbelot @ 2021-05-24  9:31 UTC (permalink / raw)
  To: dev; +Cc: Thierry Herbelot, Thomas Monjalon, stable, Jerin Jacob, Kiran Kumar K

Use stats only after it was checked not to be NULL.

Fixes: af1ae8b6a32c9 ("graph: implement stats")
Cc: stable@dpdk.org
Cc: Jerin Jacob <jerinj@marvell.com>
Cc: Kiran Kumar K <kirankumark@marvell.com>

Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
--
V2: reword patch title
---
 lib/graph/graph_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c
index 125e08d73290..a52994f0f61e 100644
--- a/lib/graph/graph_stats.c
+++ b/lib/graph/graph_stats.c
@@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster,
 	cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
 
 	stats = realloc(NULL, sz);
-	memset(stats, 0, sz);
 	if (stats) {
+		memset(stats, 0, sz);
 		stats->fn = fn;
 		stats->cluster_node_size = cluster_node_size;
 		stats->max_nodes = 0;
-- 
2.29.2


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

* Re: [dpdk-dev] [PATCH v2] graph: do not use a possibly NULL Pointer
  2021-05-24  9:31 ` [dpdk-dev] [PATCH v2] graph: " Thierry Herbelot
@ 2021-05-25  6:51   ` David Marchand
  0 siblings, 0 replies; 4+ messages in thread
From: David Marchand @ 2021-05-25  6:51 UTC (permalink / raw)
  To: Thierry Herbelot
  Cc: dev, Thomas Monjalon, dpdk stable, Jerin Jacob, Kiran Kumar K

On Mon, May 24, 2021 at 11:31 AM Thierry Herbelot
<thierry.herbelot@6wind.com> wrote:
>
> Use stats only after it was checked not to be NULL.
>
> Fixes: af1ae8b6a32c9 ("graph: implement stats")
> Cc: stable@dpdk.org
> Cc: Jerin Jacob <jerinj@marvell.com>
> Cc: Kiran Kumar K <kirankumark@marvell.com>
>
> Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
> --
> V2: reword patch title
> ---
>  lib/graph/graph_stats.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c
> index 125e08d73290..a52994f0f61e 100644
> --- a/lib/graph/graph_stats.c
> +++ b/lib/graph/graph_stats.c
> @@ -119,8 +119,8 @@ stats_mem_init(struct cluster *cluster,
>         cluster_node_size = RTE_ALIGN(cluster_node_size, RTE_CACHE_LINE_SIZE);
>
>         stats = realloc(NULL, sz);
> -       memset(stats, 0, sz);
>         if (stats) {
> +               memset(stats, 0, sz);
>                 stats->fn = fn;
>                 stats->cluster_node_size = cluster_node_size;
>                 stats->max_nodes = 0;

Please update your patches status in patchwork when submitting new revisions.

Besides, the same fix had been posted by Min Hu:
http://patchwork.dpdk.org/project/dpdk/patch/1620285387-42792-3-git-send-email-humin29@huawei.com/


-- 
David Marchand


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

end of thread, other threads:[~2021-05-25  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  8:58 [dpdk-dev] [PATCH] graph_stats: do not use a possibly NULL Pointer Thierry Herbelot
2021-05-24  9:23 ` Jerin Jacob
2021-05-24  9:31 ` [dpdk-dev] [PATCH v2] graph: " Thierry Herbelot
2021-05-25  6:51   ` 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).