[dpdk-dev] [PATCH v3] net/i40e: fix return value check issue

Zhang, Helin helin.zhang at intel.com
Wed Apr 5 17:34:07 CEST 2017



> -----Original Message-----
> From: henry [mailto:caihe at huawei.com]
> Sent: Wednesday, April 5, 2017 9:20 PM
> To: Zhang, Helin
> Cc: dev at dpdk.org; Wu, Jingjing; zhoujingbin at huawei.com; henry cai
> Subject: [PATCH v3] net/i40e: fix return value check issue
> 
> From: henry cai <caihe at huawei.com>
> 
> function i40evf_add_del_all_mac_addr without check return value of
> rte_zmalloc
> 
> Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address ")
> 
> Signed-off-by: henry cai <caihe at huawei.com>
Acked-by: Helin Zhang <helin.zhang at intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev_vf.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index d3659c9..3e0e2e1 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -2016,6 +2016,10 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev
> *dev,
>  		}
> 
>  		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];
> --
> 1.8.3.1
> 



More information about the dev mailing list