mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
[NET] kzalloc: use in alloc_netdev
Noticed this use, fixed it. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
83b950c89c
commit
31380de95c
@ -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_priv + NETDEV_ALIGN_CONST;
|
||||
|
||||
p = kmalloc(alloc_size, GFP_KERNEL);
|
||||
p = kzalloc(alloc_size, GFP_KERNEL);
|
||||
if (!p) {
|
||||
printk(KERN_ERR "alloc_dev: Unable to allocate device.\n");
|
||||
return NULL;
|
||||
}
|
||||
memset(p, 0, alloc_size);
|
||||
|
||||
dev = (struct net_device *)
|
||||
(((long)p + NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
|
||||
|
Loading…
Reference in New Issue
Block a user