net/i40e: fix allocation check
authorHenry Cai <caihe@huawei.com>
Wed, 5 Apr 2017 13:19:53 +0000 (21:19 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 19 Apr 2017 13:37:37 +0000 (15:37 +0200)
function i40evf_add_del_all_mac_addr without check return
value of rte_zmalloc

Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address")
Cc: stable@dpdk.org
Signed-off-by: Henry Cai <caihe@huawei.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
drivers/net/i40e/i40e_ethdev_vf.c

index cd9e51f..fa4d90e 100644 (file)
@@ -2024,6 +2024,10 @@ i40evf_add_del_all_mac_addr(struct rte_eth_dev *dev, bool add)
                }
 
                list = rte_zmalloc("i40evf_del_mac_buffer", len, 0);
+               if (!list) {
+                       PMD_DRV_LOG(ERR, "fail to allocate memory");
+                       return;
+               }
 
                for (i = begin; i < next_begin; i++) {
                        addr = &dev->data->mac_addrs[i];