DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tdu@semihalf.com>
To: dev@dpdk.org
Cc: nsamsono@marvell.com, jianbo.liu@arm.com, dima@marvell.com,
	mw@semihalf.com, Tomasz Duszynski <tdu@semihalf.com>
Subject: [dpdk-dev] [PATCH] net/mvpp2: check pointer before using it
Date: Mon,  4 Jun 2018 11:24:28 +0200	[thread overview]
Message-ID: <1528104268-6179-1-git-send-email-tdu@semihalf.com> (raw)

Avoid NULL dereference by checking pointer before using it.

Note that the fixes tag is before the driver was renamed
to mvpp2, so the patch will not apply that far back.

Fixes: 3588aaa68eab ("net/mrvl: fix HIF objects allocation")

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
---
 drivers/net/mvpp2/mrvl_ethdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index ae8804a..d5eb1fe 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -1614,9 +1614,12 @@ mrvl_rx_queue_release(void *rxq)
 	if (core_id == LCORE_ID_ANY)
 		core_id = 0;

+	if (!q)
+		return;
+
 	hif = mrvl_get_hif(q->priv, core_id);

-	if (!q || !hif)
+	if (!hif)
 		return;

 	tc = q->priv->rxq_map[q->queue_id].tc;
--
2.7.4

             reply	other threads:[~2018-06-04  9:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04  9:24 Tomasz Duszynski [this message]
2018-06-05 16:17 ` 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=1528104268-6179-1-git-send-email-tdu@semihalf.com \
    --to=tdu@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=dima@marvell.com \
    --cc=jianbo.liu@arm.com \
    --cc=mw@semihalf.com \
    --cc=nsamsono@marvell.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).