From: Weiguo Li <liwg06@foxmail.com>
To: hemant.agrawal@nxp.com
Cc: nipun.gupta@nxp.com, dev@dpdk.org
Subject: [PATCH] net/dpaa2: fix null pointer dereference
Date: Tue, 25 Jan 2022 22:23:48 +0800 [thread overview]
Message-ID: <tencent_093A79DF3423D6227E31B03CE6A71E113B08@qq.com> (raw)
Check for memory allocation failure is added to avoid null
pointer dereference.
Fixes: 4690a6114ff6 ("net/dpaa2: enable error queues optionally")
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
drivers/net/dpaa2/dpaa2_ethdev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 09105f049e..379daec5f4 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -399,6 +399,8 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
if (dpaa2_enable_err_queue) {
priv->rx_err_vq = rte_zmalloc("dpni_rx_err",
sizeof(struct dpaa2_queue), 0);
+ if (!priv->rx_err_vq)
+ goto fail;
dpaa2_q = (struct dpaa2_queue *)priv->rx_err_vq;
dpaa2_q->q_storage = rte_malloc("err_dq_storage",
--
2.25.1
next reply other threads:[~2022-01-25 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 14:23 Weiguo Li [this message]
2022-01-28 15:12 ` Ferruh Yigit
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=tencent_093A79DF3423D6227E31B03CE6A71E113B08@qq.com \
--to=liwg06@foxmail.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@nxp.com \
--cc=nipun.gupta@nxp.com \
/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).