[BRIDGE] ebtables: fix allocation in net/bridge/netfilter/ebtables.c
[linux-2.6-microblaze.git] / net / bridge / br_if.c
index f36b35e..59eef42 100644 (file)
@@ -210,7 +210,8 @@ static struct net_device *new_bridge_dev(const char *name)
 
        br->bridge_id.prio[0] = 0x80;
        br->bridge_id.prio[1] = 0x00;
-       memset(br->bridge_id.addr, 0, ETH_ALEN);
+
+       memcpy(br->group_addr, br_group_address, ETH_ALEN);
 
        br->feature_mask = dev->features;
        br->stp_enabled = 0;
@@ -237,12 +238,11 @@ static int find_portno(struct net_bridge *br)
        struct net_bridge_port *p;
        unsigned long *inuse;
 
-       inuse = kmalloc(BITS_TO_LONGS(BR_MAX_PORTS)*sizeof(unsigned long),
+       inuse = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
                        GFP_KERNEL);
        if (!inuse)
                return -ENOMEM;
 
-       memset(inuse, 0, BITS_TO_LONGS(BR_MAX_PORTS)*sizeof(unsigned long));
        set_bit(0, inuse);      /* zero is reserved */
        list_for_each_entry(p, &br->port_list, list) {
                set_bit(p->port_no, inuse);
@@ -264,11 +264,10 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
        if (index < 0)
                return ERR_PTR(index);
 
-       p = kmalloc(sizeof(*p), GFP_KERNEL);
+       p = kzalloc(sizeof(*p), GFP_KERNEL);
        if (p == NULL)
                return ERR_PTR(-ENOMEM);
 
-       memset(p, 0, sizeof(*p));
        p->br = br;
        dev_hold(dev);
        p->dev = dev;