diff mbox

[dpdk-dev] net/mvpp2: check pointer before using it

Message ID 1528104268-6179-1-git-send-email-tdu@semihalf.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Tomasz Duszynski June 4, 2018, 9:24 a.m. UTC
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(-)

--
2.7.4

Comments

Ferruh Yigit June 5, 2018, 4:17 p.m. UTC | #1
On 6/4/2018 10:24 AM, Tomasz Duszynski wrote:
> 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>

Applied to dpdk-next-net/master, thanks.
diff mbox

Patch

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;