* [PATCH v2] net/i40e: fix a bug in function i40evf_add_del_all_mac_addr
@ 2017-03-28 8:19 henry
2017-03-28 8:44 ` Zhang, Helin
0 siblings, 1 reply; 2+ messages in thread
From: henry @ 2017-03-28 8:19 UTC (permalink / raw)
To: helin.zhang; +Cc: dev, jingjing.wu, wangyunjian, zhoujingbin, henry
check return value of rte_zmalloc
Signed-off-by: henry <caihe@huawei.com>
---
drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 55fd344..fdb5be6 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2014,6 +2014,12 @@ 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, "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];
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net/i40e: fix a bug in function i40evf_add_del_all_mac_addr
2017-03-28 8:19 [PATCH v2] net/i40e: fix a bug in function i40evf_add_del_all_mac_addr henry
@ 2017-03-28 8:44 ` Zhang, Helin
0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Helin @ 2017-03-28 8:44 UTC (permalink / raw)
To: henry; +Cc: dev, Wu, Jingjing, wangyunjian, zhoujingbin
> -----Original Message-----
> From: henry [mailto:caihe@huawei.com]
> Sent: Tuesday, March 28, 2017 4:19 PM
> To: Zhang, Helin
> Cc: dev@dpdk.org; Wu, Jingjing; wangyunjian@huawei.com;
> zhoujingbin@huawei.com; henry
> Subject: [dpdk-dev] [PATCH v2] net/i40e: fix a bug in function
> i40evf_add_del_all_mac_addr
Suggested with new title as below.
"net/i40e: fix return value check issue"
>
> check return value of rte_zmalloc
Please add one more fix line here, as community required.
Fixes: 97ac72aa71a9 ("i40e: support setting VF MAC address ")
>
> Signed-off-by: henry <caihe@huawei.com>
If possible, please use your full name here. E.g. 'Henry He' or else. Thanks!
> ---
> drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/i40e/i40e_ethdev_vf.c
> b/drivers/net/i40e/i40e_ethdev_vf.c
> index 55fd344..fdb5be6 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -2014,6 +2014,12 @@ 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, "abort execute command %s",
> + add ? "OP_ADD_ETHER_ADDRESS" :
> + "OP_DEL_ETHER_ADDRESS");
> + return;
> + }
Suggest to describe what fails directly, as below.
PMD_DRV_LOG(ERR, "Fail to allocate memory");
>
> for (i = begin; i < next_begin; i++) {
> addr = &dev->data->mac_addrs[i];
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-28 8:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 8:19 [PATCH v2] net/i40e: fix a bug in function i40evf_add_del_all_mac_addr henry
2017-03-28 8:44 ` Zhang, Helin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.