Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0da974f4 authored by Panagiotis Issaris's avatar Panagiotis Issaris Committed by David S. Miller
Browse files

[NET]: Conversions from kmalloc+memset to k(z|c)alloc.

parent a0ee7c70
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -542,12 +542,11 @@ static struct net_device *register_vlan_device(const char *eth_IF_name,
	 * so it cannot "appear" on us.
	 */
	if (!grp) { /* need to add a new group */
		grp = kmalloc(sizeof(struct vlan_group), GFP_KERNEL);
		grp = kzalloc(sizeof(struct vlan_group), GFP_KERNEL);
		if (!grp)
			goto out_free_unregister;
					
		/* printk(KERN_ALERT "VLAN REGISTER:  Allocated new group.\n"); */
		memset(grp, 0, sizeof(struct vlan_group));
		grp->real_dev_ifindex = real_dev->ifindex;

		hlist_add_head_rcu(&grp->hlist, 
+2 −4
Original line number Diff line number Diff line
@@ -227,12 +227,11 @@ static void atif_drop_device(struct net_device *dev)
static struct atalk_iface *atif_add_device(struct net_device *dev,
					   struct atalk_addr *sa)
{
	struct atalk_iface *iface = kmalloc(sizeof(*iface), GFP_KERNEL);
	struct atalk_iface *iface = kzalloc(sizeof(*iface), GFP_KERNEL);

	if (!iface)
		goto out;

	memset(iface, 0, sizeof(*iface));
	dev_hold(dev);
	iface->dev = dev;
	dev->atalk_ptr = iface;
@@ -559,12 +558,11 @@ static int atrtr_create(struct rtentry *r, struct net_device *devhint)
	}

	if (!rt) {
		rt = kmalloc(sizeof(*rt), GFP_ATOMIC);
		rt = kzalloc(sizeof(*rt), GFP_ATOMIC);

		retval = -ENOBUFS;
		if (!rt)
			goto out_unlock;
		memset(rt, 0, sizeof(*rt));

		rt->next = atalk_routes;
		atalk_routes = rt;
+1 −2
Original line number Diff line number Diff line
@@ -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) {
+1 −2
Original line number Diff line number Diff line
@@ -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);
+1 −2
Original line number Diff line number Diff line
@@ -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;
Loading