提交 68d5ac2e 编写于 作者: W WANG Cong 提交者: David S. Miller

pktgen: use vzalloc_node() instead of vmalloc_node() + memset()

Signed-off-by: NWANG Cong <xiyou.wangcong@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 c4264f27
...@@ -3544,13 +3544,12 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) ...@@ -3544,13 +3544,12 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
return -ENOMEM; return -ENOMEM;
strcpy(pkt_dev->odevname, ifname); strcpy(pkt_dev->odevname, ifname);
pkt_dev->flows = vmalloc_node(MAX_CFLOWS * sizeof(struct flow_state), pkt_dev->flows = vzalloc_node(MAX_CFLOWS * sizeof(struct flow_state),
node); node);
if (pkt_dev->flows == NULL) { if (pkt_dev->flows == NULL) {
kfree(pkt_dev); kfree(pkt_dev);
return -ENOMEM; return -ENOMEM;
} }
memset(pkt_dev->flows, 0, MAX_CFLOWS * sizeof(struct flow_state));
pkt_dev->removal_mark = 0; pkt_dev->removal_mark = 0;
pkt_dev->min_pkt_size = ETH_ZLEN; pkt_dev->min_pkt_size = ETH_ZLEN;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册