提交 31380de9 编写于 作者: P Paolo 'Blaisorblade' Giarrusso 提交者: David S. Miller

[NET] kzalloc: use in alloc_netdev

Noticed this use, fixed it.
Signed-off-by: NPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 83b950c8
...@@ -3100,12 +3100,11 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name, ...@@ -3100,12 +3100,11 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST; alloc_size = (sizeof(*dev) + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST;
alloc_size += sizeof_priv + NETDEV_ALIGN_CONST; alloc_size += sizeof_priv + NETDEV_ALIGN_CONST;
p = kmalloc(alloc_size, GFP_KERNEL); p = kzalloc(alloc_size, GFP_KERNEL);
if (!p) { if (!p) {
printk(KERN_ERR "alloc_dev: Unable to allocate device.\n"); printk(KERN_ERR "alloc_dev: Unable to allocate device.\n");
return NULL; return NULL;
} }
memset(p, 0, alloc_size);
dev = (struct net_device *) dev = (struct net_device *)
(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); (((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册