DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL
@ 2017-08-24  7:12 Rongqiang XIE
  2017-08-25 18:43 ` Patil, Harish
  0 siblings, 1 reply; 3+ messages in thread
From: Rongqiang XIE @ 2017-08-24  7:12 UTC (permalink / raw)
  To: rasesh.mody; +Cc: dev, Rongqiang XIE

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-28 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-24  7:12 [dpdk-dev] [PATCH] net/qede:fix the bug about pointer params may NULL Rongqiang XIE
2017-08-25 18:43 ` Patil, Harish
2017-08-28 12:42   ` Ferruh Yigit

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).