aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_if.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bridge/br_if.c')
-rw-r--r--net/bridge/br_if.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index f36b35edd60c..59eef42d4a42 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -210,7 +210,8 @@ static struct net_device *new_bridge_dev(const char *name)
210 210
211 br->bridge_id.prio[0] = 0x80; 211 br->bridge_id.prio[0] = 0x80;
212 br->bridge_id.prio[1] = 0x00; 212 br->bridge_id.prio[1] = 0x00;
213 memset(br->bridge_id.addr, 0, ETH_ALEN); 213
214 memcpy(br->group_addr, br_group_address, ETH_ALEN);
214 215
215 br->feature_mask = dev->features; 216 br->feature_mask = dev->features;
216 br->stp_enabled = 0; 217 br->stp_enabled = 0;
@@ -237,12 +238,11 @@ static int find_portno(struct net_bridge *br)
237 struct net_bridge_port *p; 238 struct net_bridge_port *p;
238 unsigned long *inuse; 239 unsigned long *inuse;
239 240
240 inuse = kmalloc(BITS_TO_LONGS(BR_MAX_PORTS)*sizeof(unsigned long), 241 inuse = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
241 GFP_KERNEL); 242 GFP_KERNEL);
242 if (!inuse) 243 if (!inuse)
243 return -ENOMEM; 244 return -ENOMEM;
244 245
245 memset(inuse, 0, BITS_TO_LONGS(BR_MAX_PORTS)*sizeof(unsigned long));
246 set_bit(0, inuse); /* zero is reserved */ 246 set_bit(0, inuse); /* zero is reserved */
247 list_for_each_entry(p, &br->port_list, list) { 247 list_for_each_entry(p, &br->port_list, list) {
248 set_bit(p->port_no, inuse); 248 set_bit(p->port_no, inuse);
@@ -264,11 +264,10 @@ static struct net_bridge_port *new_nbp(struct net_bridge *br,
264 if (index < 0) 264 if (index < 0)
265 return ERR_PTR(index); 265 return ERR_PTR(index);
266 266
267 p = kmalloc(sizeof(*p), GFP_KERNEL); 267 p = kzalloc(sizeof(*p), GFP_KERNEL);
268 if (p == NULL) 268 if (p == NULL)
269 return ERR_PTR(-ENOMEM); 269 return ERR_PTR(-ENOMEM);
270 270
271 memset(p, 0, sizeof(*p));
272 p->br = br; 271 p->br = br;
273 dev_hold(dev); 272 dev_hold(dev);
274 p->dev = dev; 273 p->dev = dev;