* [PATCH 1/1] net/i40e: check return value of rte_zmalloc
@ 2017-03-25 12:30 caihe
2017-03-27 11:00 ` Ferruh Yigit
2017-03-28 1:29 ` Zhang, Helin
0 siblings, 2 replies; 3+ messages in thread
From: caihe @ 2017-03-25 12:30 UTC (permalink / raw)
To: helin.zhang; +Cc: jingjing.wu, dev, wangyunjian, Lilijun (Jerry), Zhoujingbin
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:
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net/i40e: check return value of rte_zmalloc
2017-03-25 12:30 [PATCH 1/1] net/i40e: check return value of rte_zmalloc caihe
@ 2017-03-27 11:00 ` Ferruh Yigit
2017-03-28 1:29 ` Zhang, Helin
1 sibling, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2017-03-27 11:00 UTC (permalink / raw)
To: caihe, helin.zhang
Cc: jingjing.wu, dev, wangyunjian, Lilijun (Jerry), Zhoujingbin
On 3/25/2017 12:30 PM, caihe wrote:
> 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:
Hi Caihe,
Thank you for the patches.
There are a few details to pay attention while sending patches, can you
please check the contribution guide:
http://dpdk.org/doc/guides/contributing/patches.html
Most important piece, patch requires a signed-off-by tag:
http://dpdk.org/doc/guides/contributing/patches.html#commit-messages-body
There is a DPDK IRC channel (#dpdk) on freenode irc servers, please feel
free to ask there if you have any questions.
Thanks,
ferruh
>
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] net/i40e: check return value of rte_zmalloc
2017-03-25 12:30 [PATCH 1/1] net/i40e: check return value of rte_zmalloc caihe
2017-03-27 11:00 ` Ferruh Yigit
@ 2017-03-28 1:29 ` Zhang, Helin
1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Helin @ 2017-03-28 1:29 UTC (permalink / raw)
To: caihe; +Cc: Wu, Jingjing, dev, wangyunjian, Lilijun (Jerry), Zhoujingbin
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@huawei.com]
> Sent: Saturday, March 25, 2017 8:30 PM
> To: Zhang, Helin <helin.zhang@intel.com>
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; dev@dpdk.org; wangyunjian <wangyunjian@huawei.com>; Lilijun (Jerry) <jerry.lilijun@huawei.com>; Zhoujingbin <zhoujingbin@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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-28 1:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-25 12:30 [PATCH 1/1] net/i40e: check return value of rte_zmalloc caihe
2017-03-27 11:00 ` Ferruh Yigit
2017-03-28 1:29 ` 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.