DPDK patches and discussions
 help / color / mirror / Atom feed
From: Weiguo Li <liwg06@foxmail.com>
To: jgrajcia@cisco.com
Cc: dev@dpdk.org
Subject: [PATCH] net/memif: remove pointer deference before null check
Date: Wed,  9 Feb 2022 15:27:26 +0800	[thread overview]
Message-ID: <tencent_0E1B224731F03CA9A76D11653A7EDF322308@qq.com> (raw)

There are duplicates of asignment here, the one before null check
may cause a null pointer deference, so remove the previous one.

Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
---
 drivers/net/memif/memif_socket.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c
index 42f48a68a1..7886644412 100644
--- a/drivers/net/memif/memif_socket.c
+++ b/drivers/net/memif/memif_socket.c
@@ -402,11 +402,10 @@ memif_msg_enq_init(struct rte_eth_dev *dev)
 {
 	struct pmd_internals *pmd = dev->data->dev_private;
 	struct memif_msg_queue_elt *e = memif_msg_enq(pmd->cc);
-	memif_msg_init_t *i = &e->msg.init;
+	memif_msg_init_t *i;
 
 	if (e == NULL)
 		return -1;
-
 	i = &e->msg.init;
 	e->msg.type = MEMIF_MSG_TYPE_INIT;
 	i->version = MEMIF_VERSION;
-- 
2.25.1


             reply	other threads:[~2022-02-09  7:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  7:27 Weiguo Li [this message]
2022-02-09  7:39 ` [PATCH v2] " Weiguo Li
2022-02-09 13:56   ` Ferruh Yigit
2022-02-09 17:51     ` 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_0E1B224731F03CA9A76D11653A7EDF322308@qq.com \
    --to=liwg06@foxmail.com \
    --cc=dev@dpdk.org \
    --cc=jgrajcia@cisco.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).