[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
a0ee7c70b2
commit
0da974f4f3
@@ -508,10 +508,9 @@ Note: we do not have explicit unassign, but look at _push()
|
||||
|
||||
if (copy_from_user(&be, arg, sizeof be))
|
||||
return -EFAULT;
|
||||
brvcc = kmalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
|
||||
brvcc = kzalloc(sizeof(struct br2684_vcc), GFP_KERNEL);
|
||||
if (!brvcc)
|
||||
return -ENOMEM;
|
||||
memset(brvcc, 0, sizeof(struct br2684_vcc));
|
||||
write_lock_irq(&devs_lock);
|
||||
net_dev = br2684_find_dev(&be.ifspec);
|
||||
if (net_dev == NULL) {
|
||||
|
@@ -929,12 +929,11 @@ static int arp_seq_open(struct inode *inode, struct file *file)
|
||||
struct seq_file *seq;
|
||||
int rc = -EAGAIN;
|
||||
|
||||
state = kmalloc(sizeof(*state), GFP_KERNEL);
|
||||
state = kzalloc(sizeof(*state), GFP_KERNEL);
|
||||
if (!state) {
|
||||
rc = -ENOMEM;
|
||||
goto out_kfree;
|
||||
}
|
||||
memset(state, 0, sizeof(*state));
|
||||
state->ns.neigh_sub_iter = clip_seq_sub_iter;
|
||||
|
||||
rc = seq_open(file, &arp_seq_ops);
|
||||
|
@@ -1811,12 +1811,11 @@ make_entry(struct lec_priv *priv, unsigned char *mac_addr)
|
||||
{
|
||||
struct lec_arp_table *to_return;
|
||||
|
||||
to_return = kmalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
|
||||
to_return = kzalloc(sizeof(struct lec_arp_table), GFP_ATOMIC);
|
||||
if (!to_return) {
|
||||
printk("LEC: Arp entry kmalloc failed\n");
|
||||
return NULL;
|
||||
}
|
||||
memset(to_return, 0, sizeof(struct lec_arp_table));
|
||||
memcpy(to_return->mac_addr, mac_addr, ETH_ALEN);
|
||||
init_timer(&to_return->timer);
|
||||
to_return->timer.function = lec_arp_expire_arp;
|
||||
|
@@ -258,10 +258,9 @@ static struct mpoa_client *alloc_mpc(void)
|
||||
{
|
||||
struct mpoa_client *mpc;
|
||||
|
||||
mpc = kmalloc(sizeof (struct mpoa_client), GFP_KERNEL);
|
||||
mpc = kzalloc(sizeof (struct mpoa_client), GFP_KERNEL);
|
||||
if (mpc == NULL)
|
||||
return NULL;
|
||||
memset(mpc, 0, sizeof(struct mpoa_client));
|
||||
rwlock_init(&mpc->ingress_lock);
|
||||
rwlock_init(&mpc->egress_lock);
|
||||
mpc->next = mpcs;
|
||||
|
@@ -287,10 +287,9 @@ static int pppoatm_assign_vcc(struct atm_vcc *atmvcc, void __user *arg)
|
||||
if (be.encaps != PPPOATM_ENCAPS_AUTODETECT &&
|
||||
be.encaps != PPPOATM_ENCAPS_VC && be.encaps != PPPOATM_ENCAPS_LLC)
|
||||
return -EINVAL;
|
||||
pvcc = kmalloc(sizeof(*pvcc), GFP_KERNEL);
|
||||
pvcc = kzalloc(sizeof(*pvcc), GFP_KERNEL);
|
||||
if (pvcc == NULL)
|
||||
return -ENOMEM;
|
||||
memset(pvcc, 0, sizeof(*pvcc));
|
||||
pvcc->atmvcc = atmvcc;
|
||||
pvcc->old_push = atmvcc->push;
|
||||
pvcc->old_pop = atmvcc->pop;
|
||||
|
@@ -33,10 +33,9 @@ static struct atm_dev *__alloc_atm_dev(const char *type)
|
||||
{
|
||||
struct atm_dev *dev;
|
||||
|
||||
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
|
||||
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
|
||||
if (!dev)
|
||||
return NULL;
|
||||
memset(dev, 0, sizeof(*dev));
|
||||
dev->type = type;
|
||||
dev->signal = ATM_PHY_SIG_UNKNOWN;
|
||||
dev->link_rate = ATM_OC3_PCR;
|
||||
|
Reference in New Issue
Block a user