DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rongqiang XIE <xie.rongqiang@zte.com.cn>
To: rasesh.mody@cavium.com
Cc: dev@dpdk.org, Rongqiang XIE <xie.rongqiang@zte.com.cn>
Subject: [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL
Date: Thu, 24 Aug 2017 15:12:33 +0800	[thread overview]
Message-ID: <1503558753-8545-1-git-send-email-xie.rongqiang@zte.com.cn> (raw)

In function qede_rss_reta_update(),the pointer params returned from
call to function rte_zmalloc() may be NULL and will be dereferenced.
So, should judge the params is NULL or not.

Signed-off-by: Rongqiang XIE <xie.rongqiang@zte.com.cn>
---
 drivers/net/qede/qede_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 0e05989..4e9e89f 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -2012,6 +2012,10 @@ int qede_rss_reta_update(struct rte_eth_dev *eth_dev,
 	memset(&vport_update_params, 0, sizeof(vport_update_params));
 	params = rte_zmalloc("qede_rss", sizeof(*params) * edev->num_hwfns,
 			     RTE_CACHE_LINE_SIZE);
+	if (params == NULL) {
+		DP_ERR(edev, "failed to allocate memory\n");
+		return -ENOMEM;
+	}
 
 	for (i = 0; i < reta_size; i++) {
 		idx = i / RTE_RETA_GROUP_SIZE;
-- 
1.8.3.1

             reply	other threads:[~2017-08-24  7:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-24  7:12 Rongqiang XIE [this message]
2017-08-25 18:43 ` Patil, Harish
2017-08-28 12:42   ` 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=1503558753-8545-1-git-send-email-xie.rongqiang@zte.com.cn \
    --to=xie.rongqiang@zte.com.cn \
    --cc=dev@dpdk.org \
    --cc=rasesh.mody@cavium.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).