From: Thierry Herbelot <thierry.herbelot@6wind.com>
To: dev@dpdk.org
Cc: Thierry Herbelot <thierry.herbelot@6wind.com>,
Thomas Monjalon <thomas@monjalon.net>,
stable@dpdk.org, Jerin Jacob <jerinj@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>
Subject: [dpdk-dev] [PATCH v2] graph: do not use a possibly NULL Pointer
Date: Mon, 24 May 2021 11:31:36 +0200 [thread overview]
Message-ID: <20210524093136.20525-1-thierry.herbelot@6wind.com> (raw)
In-Reply-To: <20210524085850.16095-1-thierry.herbelot@6wind.com>
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
next prev parent reply other threads:[~2021-05-24 9:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-24 8:58 [dpdk-dev] [PATCH] graph_stats: " Thierry Herbelot
2021-05-24 9:23 ` Jerin Jacob
2021-05-24 9:31 ` Thierry Herbelot [this message]
2021-05-25 6:51 ` [dpdk-dev] [PATCH v2] graph: " David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210524093136.20525-1-thierry.herbelot@6wind.com \
--to=thierry.herbelot@6wind.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).