From ef86e67ad5d873573882e19d92a206a842d22927 Mon Sep 17 00:00:00 2001 From: RongQiang Xie Date: Thu, 24 Aug 2017 15:12:33 +0800 Subject: [PATCH] net/qede: fix possible null pointer dereference 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 if the params is NULL or not. Fixes: 8b3ee85efe11 ("net/qede: fix RSS table entries for 100G adapter") Cc: stable@dpdk.org Signed-off-by: RongQiang Xie Acked-by: Harish Patil --- 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 0e05989870..4e9e89fad9 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; -- 2.20.1