[dpdk-dev] [PATCH 1/1] net/i40e: check return value of rte_zmalloc

Zhang, Helin helin.zhang at intel.com
Tue Mar 28 03:29:27 CEST 2017


Hi Cai He

Yes, I agree with you.
Please rework your patch, and send out another version. Thank you very much for the good catch!

Regards,
Helin

> -----Original Message-----
> From: caihe [mailto:caihe at huawei.com] 
> Sent: Saturday, March 25, 2017 8:30 PM
> To: Zhang, Helin <helin.zhang at intel.com>
> Cc: Wu, Jingjing <jingjing.wu at intel.com>; dev at dpdk.org; wangyunjian <wangyunjian at huawei.com>; Lilijun (Jerry) <jerry.lilijun at huawei.com>; Zhoujingbin <zhoujingbin at huawei.com>
> Subject: [dpdk-dev] [PATCH 1/1] net/i40e: check return value of rte_zmalloc
I think it can be a bug fix, so please start with 'fix' in the title.
>
> Hi helin,
>
> There is a bug without check the return value of alloc memory in function i40evf_add_del_all_mac_addr, if we should fix it as below:
Please describe the issue with more details.

'Signoff' line is needed, please use 'git format --signoff <>' to generate the patches.
'Fix' line is also needed, as it is a bug fix. Please refer to other fix commit for more details. 

>
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
> index 55fd344..37ea7ac 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -2014,6 +2014,11 @@ 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 alloc memory, abort execute command %s",
> +                               add ? "OP_ADD_ETHER_ADDRESS" : "OP_DEL_ETHER_ADDRESS");
> +                       return;
> +               }
>  
>                 for (i = begin; i < next_begin; i++) {
>                         addr = &dev->data->mac_addrs[i];
>
> Best Regards



More information about the dev mailing list