提交 7943986c 编写于 作者: S Stephen Hemminger 提交者: David S. Miller

net: use kcalloc in netdev_queue alloc

Minor nit, use size_t for allocation size and kcalloc to allocate
an array. Probably makes no actual code difference.
Signed-off-by: NStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 847499ce
...@@ -4207,7 +4207,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, ...@@ -4207,7 +4207,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
{ {
struct netdev_queue *tx; struct netdev_queue *tx;
struct net_device *dev; struct net_device *dev;
int alloc_size; size_t alloc_size;
void *p; void *p;
BUG_ON(strlen(name) >= sizeof(dev->name)); BUG_ON(strlen(name) >= sizeof(dev->name));
...@@ -4227,7 +4227,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name, ...@@ -4227,7 +4227,7 @@ struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
return NULL; return NULL;
} }
tx = kzalloc(sizeof(struct netdev_queue) * queue_count, GFP_KERNEL); tx = kcalloc(queue_count, sizeof(struct netdev_queue), GFP_KERNEL);
if (!tx) { if (!tx) {
printk(KERN_ERR "alloc_netdev: Unable to allocate " printk(KERN_ERR "alloc_netdev: Unable to allocate "
"tx qdiscs.\n"); "tx qdiscs.\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册