diff options
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/act_api.c | 9 | ||||
-rw-r--r-- | net/sched/act_pedit.c | 3 | ||||
-rw-r--r-- | net/sched/act_police.c | 6 | ||||
-rw-r--r-- | net/sched/cls_basic.c | 6 | ||||
-rw-r--r-- | net/sched/cls_fw.c | 6 | ||||
-rw-r--r-- | net/sched/cls_route.c | 9 | ||||
-rw-r--r-- | net/sched/cls_rsvp.h | 9 | ||||
-rw-r--r-- | net/sched/cls_tcindex.c | 12 | ||||
-rw-r--r-- | net/sched/cls_u32.c | 15 | ||||
-rw-r--r-- | net/sched/em_meta.c | 3 | ||||
-rw-r--r-- | net/sched/ematch.c | 3 | ||||
-rw-r--r-- | net/sched/estimator.c | 3 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 3 | ||||
-rw-r--r-- | net/sched/sch_generic.c | 3 | ||||
-rw-r--r-- | net/sched/sch_gred.c | 3 | ||||
-rw-r--r-- | net/sched/sch_hfsc.c | 3 | ||||
-rw-r--r-- | net/sched/sch_htb.c | 3 | ||||
-rw-r--r-- | net/sched/sch_netem.c | 4 |
18 files changed, 36 insertions, 67 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 9affeeedf107..a2587b52e531 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -312,10 +312,9 @@ struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, | |||
312 | } | 312 | } |
313 | 313 | ||
314 | *err = -ENOMEM; | 314 | *err = -ENOMEM; |
315 | a = kmalloc(sizeof(*a), GFP_KERNEL); | 315 | a = kzalloc(sizeof(*a), GFP_KERNEL); |
316 | if (a == NULL) | 316 | if (a == NULL) |
317 | goto err_mod; | 317 | goto err_mod; |
318 | memset(a, 0, sizeof(*a)); | ||
319 | 318 | ||
320 | /* backward compatibility for policer */ | 319 | /* backward compatibility for policer */ |
321 | if (name == NULL) | 320 | if (name == NULL) |
@@ -492,10 +491,9 @@ tcf_action_get_1(struct rtattr *rta, struct nlmsghdr *n, u32 pid, int *err) | |||
492 | index = *(int *)RTA_DATA(tb[TCA_ACT_INDEX - 1]); | 491 | index = *(int *)RTA_DATA(tb[TCA_ACT_INDEX - 1]); |
493 | 492 | ||
494 | *err = -ENOMEM; | 493 | *err = -ENOMEM; |
495 | a = kmalloc(sizeof(struct tc_action), GFP_KERNEL); | 494 | a = kzalloc(sizeof(struct tc_action), GFP_KERNEL); |
496 | if (a == NULL) | 495 | if (a == NULL) |
497 | return NULL; | 496 | return NULL; |
498 | memset(a, 0, sizeof(struct tc_action)); | ||
499 | 497 | ||
500 | *err = -EINVAL; | 498 | *err = -EINVAL; |
501 | a->ops = tc_lookup_action(tb[TCA_ACT_KIND - 1]); | 499 | a->ops = tc_lookup_action(tb[TCA_ACT_KIND - 1]); |
@@ -531,12 +529,11 @@ static struct tc_action *create_a(int i) | |||
531 | { | 529 | { |
532 | struct tc_action *act; | 530 | struct tc_action *act; |
533 | 531 | ||
534 | act = kmalloc(sizeof(*act), GFP_KERNEL); | 532 | act = kzalloc(sizeof(*act), GFP_KERNEL); |
535 | if (act == NULL) { | 533 | if (act == NULL) { |
536 | printk("create_a: failed to alloc!\n"); | 534 | printk("create_a: failed to alloc!\n"); |
537 | return NULL; | 535 | return NULL; |
538 | } | 536 | } |
539 | memset(act, 0, sizeof(*act)); | ||
540 | act->order = i; | 537 | act->order = i; |
541 | return act; | 538 | return act; |
542 | } | 539 | } |
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c index 58b3a8652042..f257475e0e0c 100644 --- a/net/sched/act_pedit.c +++ b/net/sched/act_pedit.c | |||
@@ -209,10 +209,9 @@ tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,int bind, int ref) | |||
209 | s = sizeof(*opt) + p->nkeys * sizeof(struct tc_pedit_key); | 209 | s = sizeof(*opt) + p->nkeys * sizeof(struct tc_pedit_key); |
210 | 210 | ||
211 | /* netlink spinlocks held above us - must use ATOMIC */ | 211 | /* netlink spinlocks held above us - must use ATOMIC */ |
212 | opt = kmalloc(s, GFP_ATOMIC); | 212 | opt = kzalloc(s, GFP_ATOMIC); |
213 | if (opt == NULL) | 213 | if (opt == NULL) |
214 | return -ENOBUFS; | 214 | return -ENOBUFS; |
215 | memset(opt, 0, s); | ||
216 | 215 | ||
217 | memcpy(opt->keys, p->keys, p->nkeys * sizeof(struct tc_pedit_key)); | 216 | memcpy(opt->keys, p->keys, p->nkeys * sizeof(struct tc_pedit_key)); |
218 | opt->index = p->index; | 217 | opt->index = p->index; |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 47e00bd9625e..da905d7b4b40 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -196,10 +196,9 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est, | |||
196 | return ret; | 196 | return ret; |
197 | } | 197 | } |
198 | 198 | ||
199 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 199 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
200 | if (p == NULL) | 200 | if (p == NULL) |
201 | return -ENOMEM; | 201 | return -ENOMEM; |
202 | memset(p, 0, sizeof(*p)); | ||
203 | 202 | ||
204 | ret = ACT_P_CREATED; | 203 | ret = ACT_P_CREATED; |
205 | p->refcnt = 1; | 204 | p->refcnt = 1; |
@@ -429,11 +428,10 @@ struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est) | |||
429 | return p; | 428 | return p; |
430 | } | 429 | } |
431 | 430 | ||
432 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 431 | p = kzalloc(sizeof(*p), GFP_KERNEL); |
433 | if (p == NULL) | 432 | if (p == NULL) |
434 | return NULL; | 433 | return NULL; |
435 | 434 | ||
436 | memset(p, 0, sizeof(*p)); | ||
437 | p->refcnt = 1; | 435 | p->refcnt = 1; |
438 | spin_lock_init(&p->lock); | 436 | spin_lock_init(&p->lock); |
439 | p->stats_lock = &p->lock; | 437 | p->stats_lock = &p->lock; |
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c index 61507f006b11..86cac49a0531 100644 --- a/net/sched/cls_basic.c +++ b/net/sched/cls_basic.c | |||
@@ -178,19 +178,17 @@ static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
178 | 178 | ||
179 | err = -ENOBUFS; | 179 | err = -ENOBUFS; |
180 | if (head == NULL) { | 180 | if (head == NULL) { |
181 | head = kmalloc(sizeof(*head), GFP_KERNEL); | 181 | head = kzalloc(sizeof(*head), GFP_KERNEL); |
182 | if (head == NULL) | 182 | if (head == NULL) |
183 | goto errout; | 183 | goto errout; |
184 | 184 | ||
185 | memset(head, 0, sizeof(*head)); | ||
186 | INIT_LIST_HEAD(&head->flist); | 185 | INIT_LIST_HEAD(&head->flist); |
187 | tp->root = head; | 186 | tp->root = head; |
188 | } | 187 | } |
189 | 188 | ||
190 | f = kmalloc(sizeof(*f), GFP_KERNEL); | 189 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
191 | if (f == NULL) | 190 | if (f == NULL) |
192 | goto errout; | 191 | goto errout; |
193 | memset(f, 0, sizeof(*f)); | ||
194 | 192 | ||
195 | err = -EINVAL; | 193 | err = -EINVAL; |
196 | if (handle) | 194 | if (handle) |
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c index d41de91fc4f6..e6973d9b686d 100644 --- a/net/sched/cls_fw.c +++ b/net/sched/cls_fw.c | |||
@@ -267,20 +267,18 @@ static int fw_change(struct tcf_proto *tp, unsigned long base, | |||
267 | return -EINVAL; | 267 | return -EINVAL; |
268 | 268 | ||
269 | if (head == NULL) { | 269 | if (head == NULL) { |
270 | head = kmalloc(sizeof(struct fw_head), GFP_KERNEL); | 270 | head = kzalloc(sizeof(struct fw_head), GFP_KERNEL); |
271 | if (head == NULL) | 271 | if (head == NULL) |
272 | return -ENOBUFS; | 272 | return -ENOBUFS; |
273 | memset(head, 0, sizeof(*head)); | ||
274 | 273 | ||
275 | tcf_tree_lock(tp); | 274 | tcf_tree_lock(tp); |
276 | tp->root = head; | 275 | tp->root = head; |
277 | tcf_tree_unlock(tp); | 276 | tcf_tree_unlock(tp); |
278 | } | 277 | } |
279 | 278 | ||
280 | f = kmalloc(sizeof(struct fw_filter), GFP_KERNEL); | 279 | f = kzalloc(sizeof(struct fw_filter), GFP_KERNEL); |
281 | if (f == NULL) | 280 | if (f == NULL) |
282 | return -ENOBUFS; | 281 | return -ENOBUFS; |
283 | memset(f, 0, sizeof(*f)); | ||
284 | 282 | ||
285 | f->id = handle; | 283 | f->id = handle; |
286 | 284 | ||
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index c2e71900f7bd..d3aea730d4c8 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
@@ -396,10 +396,9 @@ static int route4_set_parms(struct tcf_proto *tp, unsigned long base, | |||
396 | h1 = to_hash(nhandle); | 396 | h1 = to_hash(nhandle); |
397 | if ((b = head->table[h1]) == NULL) { | 397 | if ((b = head->table[h1]) == NULL) { |
398 | err = -ENOBUFS; | 398 | err = -ENOBUFS; |
399 | b = kmalloc(sizeof(struct route4_bucket), GFP_KERNEL); | 399 | b = kzalloc(sizeof(struct route4_bucket), GFP_KERNEL); |
400 | if (b == NULL) | 400 | if (b == NULL) |
401 | goto errout; | 401 | goto errout; |
402 | memset(b, 0, sizeof(*b)); | ||
403 | 402 | ||
404 | tcf_tree_lock(tp); | 403 | tcf_tree_lock(tp); |
405 | head->table[h1] = b; | 404 | head->table[h1] = b; |
@@ -475,20 +474,18 @@ static int route4_change(struct tcf_proto *tp, unsigned long base, | |||
475 | 474 | ||
476 | err = -ENOBUFS; | 475 | err = -ENOBUFS; |
477 | if (head == NULL) { | 476 | if (head == NULL) { |
478 | head = kmalloc(sizeof(struct route4_head), GFP_KERNEL); | 477 | head = kzalloc(sizeof(struct route4_head), GFP_KERNEL); |
479 | if (head == NULL) | 478 | if (head == NULL) |
480 | goto errout; | 479 | goto errout; |
481 | memset(head, 0, sizeof(struct route4_head)); | ||
482 | 480 | ||
483 | tcf_tree_lock(tp); | 481 | tcf_tree_lock(tp); |
484 | tp->root = head; | 482 | tp->root = head; |
485 | tcf_tree_unlock(tp); | 483 | tcf_tree_unlock(tp); |
486 | } | 484 | } |
487 | 485 | ||
488 | f = kmalloc(sizeof(struct route4_filter), GFP_KERNEL); | 486 | f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL); |
489 | if (f == NULL) | 487 | if (f == NULL) |
490 | goto errout; | 488 | goto errout; |
491 | memset(f, 0, sizeof(*f)); | ||
492 | 489 | ||
493 | err = route4_set_parms(tp, base, f, handle, head, tb, | 490 | err = route4_set_parms(tp, base, f, handle, head, tb, |
494 | tca[TCA_RATE-1], 1); | 491 | tca[TCA_RATE-1], 1); |
diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h index ba8741971629..6e230ecfba05 100644 --- a/net/sched/cls_rsvp.h +++ b/net/sched/cls_rsvp.h | |||
@@ -240,9 +240,8 @@ static int rsvp_init(struct tcf_proto *tp) | |||
240 | { | 240 | { |
241 | struct rsvp_head *data; | 241 | struct rsvp_head *data; |
242 | 242 | ||
243 | data = kmalloc(sizeof(struct rsvp_head), GFP_KERNEL); | 243 | data = kzalloc(sizeof(struct rsvp_head), GFP_KERNEL); |
244 | if (data) { | 244 | if (data) { |
245 | memset(data, 0, sizeof(struct rsvp_head)); | ||
246 | tp->root = data; | 245 | tp->root = data; |
247 | return 0; | 246 | return 0; |
248 | } | 247 | } |
@@ -446,11 +445,10 @@ static int rsvp_change(struct tcf_proto *tp, unsigned long base, | |||
446 | goto errout2; | 445 | goto errout2; |
447 | 446 | ||
448 | err = -ENOBUFS; | 447 | err = -ENOBUFS; |
449 | f = kmalloc(sizeof(struct rsvp_filter), GFP_KERNEL); | 448 | f = kzalloc(sizeof(struct rsvp_filter), GFP_KERNEL); |
450 | if (f == NULL) | 449 | if (f == NULL) |
451 | goto errout2; | 450 | goto errout2; |
452 | 451 | ||
453 | memset(f, 0, sizeof(*f)); | ||
454 | h2 = 16; | 452 | h2 = 16; |
455 | if (tb[TCA_RSVP_SRC-1]) { | 453 | if (tb[TCA_RSVP_SRC-1]) { |
456 | err = -EINVAL; | 454 | err = -EINVAL; |
@@ -532,10 +530,9 @@ insert: | |||
532 | /* No session found. Create new one. */ | 530 | /* No session found. Create new one. */ |
533 | 531 | ||
534 | err = -ENOBUFS; | 532 | err = -ENOBUFS; |
535 | s = kmalloc(sizeof(struct rsvp_session), GFP_KERNEL); | 533 | s = kzalloc(sizeof(struct rsvp_session), GFP_KERNEL); |
536 | if (s == NULL) | 534 | if (s == NULL) |
537 | goto errout; | 535 | goto errout; |
538 | memset(s, 0, sizeof(*s)); | ||
539 | memcpy(s->dst, dst, sizeof(s->dst)); | 536 | memcpy(s->dst, dst, sizeof(s->dst)); |
540 | 537 | ||
541 | if (pinfo) { | 538 | if (pinfo) { |
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 7870e7bb0bac..5af8a59e1503 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
@@ -148,11 +148,10 @@ static int tcindex_init(struct tcf_proto *tp) | |||
148 | struct tcindex_data *p; | 148 | struct tcindex_data *p; |
149 | 149 | ||
150 | DPRINTK("tcindex_init(tp %p)\n",tp); | 150 | DPRINTK("tcindex_init(tp %p)\n",tp); |
151 | p = kmalloc(sizeof(struct tcindex_data),GFP_KERNEL); | 151 | p = kzalloc(sizeof(struct tcindex_data),GFP_KERNEL); |
152 | if (!p) | 152 | if (!p) |
153 | return -ENOMEM; | 153 | return -ENOMEM; |
154 | 154 | ||
155 | memset(p, 0, sizeof(*p)); | ||
156 | p->mask = 0xffff; | 155 | p->mask = 0xffff; |
157 | p->hash = DEFAULT_HASH_SIZE; | 156 | p->hash = DEFAULT_HASH_SIZE; |
158 | p->fall_through = 1; | 157 | p->fall_through = 1; |
@@ -296,16 +295,14 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
296 | err = -ENOMEM; | 295 | err = -ENOMEM; |
297 | if (!cp.perfect && !cp.h) { | 296 | if (!cp.perfect && !cp.h) { |
298 | if (valid_perfect_hash(&cp)) { | 297 | if (valid_perfect_hash(&cp)) { |
299 | cp.perfect = kmalloc(cp.hash * sizeof(*r), GFP_KERNEL); | 298 | cp.perfect = kcalloc(cp.hash, sizeof(*r), GFP_KERNEL); |
300 | if (!cp.perfect) | 299 | if (!cp.perfect) |
301 | goto errout; | 300 | goto errout; |
302 | memset(cp.perfect, 0, cp.hash * sizeof(*r)); | ||
303 | balloc = 1; | 301 | balloc = 1; |
304 | } else { | 302 | } else { |
305 | cp.h = kmalloc(cp.hash * sizeof(f), GFP_KERNEL); | 303 | cp.h = kcalloc(cp.hash, sizeof(f), GFP_KERNEL); |
306 | if (!cp.h) | 304 | if (!cp.h) |
307 | goto errout; | 305 | goto errout; |
308 | memset(cp.h, 0, cp.hash * sizeof(f)); | ||
309 | balloc = 2; | 306 | balloc = 2; |
310 | } | 307 | } |
311 | } | 308 | } |
@@ -316,10 +313,9 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
316 | r = tcindex_lookup(&cp, handle) ? : &new_filter_result; | 313 | r = tcindex_lookup(&cp, handle) ? : &new_filter_result; |
317 | 314 | ||
318 | if (r == &new_filter_result) { | 315 | if (r == &new_filter_result) { |
319 | f = kmalloc(sizeof(*f), GFP_KERNEL); | 316 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
320 | if (!f) | 317 | if (!f) |
321 | goto errout_alloc; | 318 | goto errout_alloc; |
322 | memset(f, 0, sizeof(*f)); | ||
323 | } | 319 | } |
324 | 320 | ||
325 | if (tb[TCA_TCINDEX_CLASSID-1]) { | 321 | if (tb[TCA_TCINDEX_CLASSID-1]) { |
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index d712edcd1bcf..eea366966740 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
@@ -307,23 +307,21 @@ static int u32_init(struct tcf_proto *tp) | |||
307 | if (tp_c->q == tp->q) | 307 | if (tp_c->q == tp->q) |
308 | break; | 308 | break; |
309 | 309 | ||
310 | root_ht = kmalloc(sizeof(*root_ht), GFP_KERNEL); | 310 | root_ht = kzalloc(sizeof(*root_ht), GFP_KERNEL); |
311 | if (root_ht == NULL) | 311 | if (root_ht == NULL) |
312 | return -ENOBUFS; | 312 | return -ENOBUFS; |
313 | 313 | ||
314 | memset(root_ht, 0, sizeof(*root_ht)); | ||
315 | root_ht->divisor = 0; | 314 | root_ht->divisor = 0; |
316 | root_ht->refcnt++; | 315 | root_ht->refcnt++; |
317 | root_ht->handle = tp_c ? gen_new_htid(tp_c) : 0x80000000; | 316 | root_ht->handle = tp_c ? gen_new_htid(tp_c) : 0x80000000; |
318 | root_ht->prio = tp->prio; | 317 | root_ht->prio = tp->prio; |
319 | 318 | ||
320 | if (tp_c == NULL) { | 319 | if (tp_c == NULL) { |
321 | tp_c = kmalloc(sizeof(*tp_c), GFP_KERNEL); | 320 | tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL); |
322 | if (tp_c == NULL) { | 321 | if (tp_c == NULL) { |
323 | kfree(root_ht); | 322 | kfree(root_ht); |
324 | return -ENOBUFS; | 323 | return -ENOBUFS; |
325 | } | 324 | } |
326 | memset(tp_c, 0, sizeof(*tp_c)); | ||
327 | tp_c->q = tp->q; | 325 | tp_c->q = tp->q; |
328 | tp_c->next = u32_list; | 326 | tp_c->next = u32_list; |
329 | u32_list = tp_c; | 327 | u32_list = tp_c; |
@@ -571,10 +569,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
571 | if (handle == 0) | 569 | if (handle == 0) |
572 | return -ENOMEM; | 570 | return -ENOMEM; |
573 | } | 571 | } |
574 | ht = kmalloc(sizeof(*ht) + divisor*sizeof(void*), GFP_KERNEL); | 572 | ht = kzalloc(sizeof(*ht) + divisor*sizeof(void*), GFP_KERNEL); |
575 | if (ht == NULL) | 573 | if (ht == NULL) |
576 | return -ENOBUFS; | 574 | return -ENOBUFS; |
577 | memset(ht, 0, sizeof(*ht) + divisor*sizeof(void*)); | ||
578 | ht->tp_c = tp_c; | 575 | ht->tp_c = tp_c; |
579 | ht->refcnt = 0; | 576 | ht->refcnt = 0; |
580 | ht->divisor = divisor; | 577 | ht->divisor = divisor; |
@@ -617,18 +614,16 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
617 | 614 | ||
618 | s = RTA_DATA(tb[TCA_U32_SEL-1]); | 615 | s = RTA_DATA(tb[TCA_U32_SEL-1]); |
619 | 616 | ||
620 | n = kmalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL); | 617 | n = kzalloc(sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key), GFP_KERNEL); |
621 | if (n == NULL) | 618 | if (n == NULL) |
622 | return -ENOBUFS; | 619 | return -ENOBUFS; |
623 | 620 | ||
624 | memset(n, 0, sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key)); | ||
625 | #ifdef CONFIG_CLS_U32_PERF | 621 | #ifdef CONFIG_CLS_U32_PERF |
626 | n->pf = kmalloc(sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64), GFP_KERNEL); | 622 | n->pf = kzalloc(sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64), GFP_KERNEL); |
627 | if (n->pf == NULL) { | 623 | if (n->pf == NULL) { |
628 | kfree(n); | 624 | kfree(n); |
629 | return -ENOBUFS; | 625 | return -ENOBUFS; |
630 | } | 626 | } |
631 | memset(n->pf, 0, sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64)); | ||
632 | #endif | 627 | #endif |
633 | 628 | ||
634 | memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); | 629 | memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key)); |
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c index 698372954f4d..61e3b740ab1a 100644 --- a/net/sched/em_meta.c +++ b/net/sched/em_meta.c | |||
@@ -773,10 +773,9 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len, | |||
773 | TCF_META_ID(hdr->right.kind) > TCF_META_ID_MAX) | 773 | TCF_META_ID(hdr->right.kind) > TCF_META_ID_MAX) |
774 | goto errout; | 774 | goto errout; |
775 | 775 | ||
776 | meta = kmalloc(sizeof(*meta), GFP_KERNEL); | 776 | meta = kzalloc(sizeof(*meta), GFP_KERNEL); |
777 | if (meta == NULL) | 777 | if (meta == NULL) |
778 | goto errout; | 778 | goto errout; |
779 | memset(meta, 0, sizeof(*meta)); | ||
780 | 779 | ||
781 | memcpy(&meta->lvalue.hdr, &hdr->left, sizeof(hdr->left)); | 780 | memcpy(&meta->lvalue.hdr, &hdr->left, sizeof(hdr->left)); |
782 | memcpy(&meta->rvalue.hdr, &hdr->right, sizeof(hdr->right)); | 781 | memcpy(&meta->rvalue.hdr, &hdr->right, sizeof(hdr->right)); |
diff --git a/net/sched/ematch.c b/net/sched/ematch.c index 2405a86093a2..0fd0768a17c6 100644 --- a/net/sched/ematch.c +++ b/net/sched/ematch.c | |||
@@ -321,10 +321,9 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta, | |||
321 | list_len = RTA_PAYLOAD(rt_list); | 321 | list_len = RTA_PAYLOAD(rt_list); |
322 | matches_len = tree_hdr->nmatches * sizeof(*em); | 322 | matches_len = tree_hdr->nmatches * sizeof(*em); |
323 | 323 | ||
324 | tree->matches = kmalloc(matches_len, GFP_KERNEL); | 324 | tree->matches = kzalloc(matches_len, GFP_KERNEL); |
325 | if (tree->matches == NULL) | 325 | if (tree->matches == NULL) |
326 | goto errout; | 326 | goto errout; |
327 | memset(tree->matches, 0, matches_len); | ||
328 | 327 | ||
329 | /* We do not use rtattr_parse_nested here because the maximum | 328 | /* We do not use rtattr_parse_nested here because the maximum |
330 | * number of attributes is unknown. This saves us the allocation | 329 | * number of attributes is unknown. This saves us the allocation |
diff --git a/net/sched/estimator.c b/net/sched/estimator.c index 5d3ae03e22a7..0ebc98e9be2d 100644 --- a/net/sched/estimator.c +++ b/net/sched/estimator.c | |||
@@ -139,11 +139,10 @@ int qdisc_new_estimator(struct tc_stats *stats, spinlock_t *stats_lock, struct r | |||
139 | if (parm->interval < -2 || parm->interval > 3) | 139 | if (parm->interval < -2 || parm->interval > 3) |
140 | return -EINVAL; | 140 | return -EINVAL; |
141 | 141 | ||
142 | est = kmalloc(sizeof(*est), GFP_KERNEL); | 142 | est = kzalloc(sizeof(*est), GFP_KERNEL); |
143 | if (est == NULL) | 143 | if (est == NULL) |
144 | return -ENOBUFS; | 144 | return -ENOBUFS; |
145 | 145 | ||
146 | memset(est, 0, sizeof(*est)); | ||
147 | est->interval = parm->interval + 2; | 146 | est->interval = parm->interval + 2; |
148 | est->stats = stats; | 147 | est->stats = stats; |
149 | est->stats_lock = stats_lock; | 148 | est->stats_lock = stats_lock; |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 80b7f6a8d008..bac881bfe362 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -1926,10 +1926,9 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t | |||
1926 | } | 1926 | } |
1927 | 1927 | ||
1928 | err = -ENOBUFS; | 1928 | err = -ENOBUFS; |
1929 | cl = kmalloc(sizeof(*cl), GFP_KERNEL); | 1929 | cl = kzalloc(sizeof(*cl), GFP_KERNEL); |
1930 | if (cl == NULL) | 1930 | if (cl == NULL) |
1931 | goto failure; | 1931 | goto failure; |
1932 | memset(cl, 0, sizeof(*cl)); | ||
1933 | cl->R_tab = rtab; | 1932 | cl->R_tab = rtab; |
1934 | rtab = NULL; | 1933 | rtab = NULL; |
1935 | cl->refcnt = 1; | 1934 | cl->refcnt = 1; |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index d735f51686a1..0834c2ee9174 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -432,10 +432,9 @@ struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops) | |||
432 | size = QDISC_ALIGN(sizeof(*sch)); | 432 | size = QDISC_ALIGN(sizeof(*sch)); |
433 | size += ops->priv_size + (QDISC_ALIGNTO - 1); | 433 | size += ops->priv_size + (QDISC_ALIGNTO - 1); |
434 | 434 | ||
435 | p = kmalloc(size, GFP_KERNEL); | 435 | p = kzalloc(size, GFP_KERNEL); |
436 | if (!p) | 436 | if (!p) |
437 | goto errout; | 437 | goto errout; |
438 | memset(p, 0, size); | ||
439 | sch = (struct Qdisc *) QDISC_ALIGN((unsigned long) p); | 438 | sch = (struct Qdisc *) QDISC_ALIGN((unsigned long) p); |
440 | sch->padded = (char *) sch - (char *) p; | 439 | sch->padded = (char *) sch - (char *) p; |
441 | 440 | ||
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c index 0cafdd5feb1b..18e81a8ffb01 100644 --- a/net/sched/sch_gred.c +++ b/net/sched/sch_gred.c | |||
@@ -406,10 +406,9 @@ static inline int gred_change_vq(struct Qdisc *sch, int dp, | |||
406 | struct gred_sched_data *q; | 406 | struct gred_sched_data *q; |
407 | 407 | ||
408 | if (table->tab[dp] == NULL) { | 408 | if (table->tab[dp] == NULL) { |
409 | table->tab[dp] = kmalloc(sizeof(*q), GFP_KERNEL); | 409 | table->tab[dp] = kzalloc(sizeof(*q), GFP_KERNEL); |
410 | if (table->tab[dp] == NULL) | 410 | if (table->tab[dp] == NULL) |
411 | return -ENOMEM; | 411 | return -ENOMEM; |
412 | memset(table->tab[dp], 0, sizeof(*q)); | ||
413 | } | 412 | } |
414 | 413 | ||
415 | q = table->tab[dp]; | 414 | q = table->tab[dp]; |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 6b1b4a981e88..6a6735a2ed35 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -1123,10 +1123,9 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
1123 | if (rsc == NULL && fsc == NULL) | 1123 | if (rsc == NULL && fsc == NULL) |
1124 | return -EINVAL; | 1124 | return -EINVAL; |
1125 | 1125 | ||
1126 | cl = kmalloc(sizeof(struct hfsc_class), GFP_KERNEL); | 1126 | cl = kzalloc(sizeof(struct hfsc_class), GFP_KERNEL); |
1127 | if (cl == NULL) | 1127 | if (cl == NULL) |
1128 | return -ENOBUFS; | 1128 | return -ENOBUFS; |
1129 | memset(cl, 0, sizeof(struct hfsc_class)); | ||
1130 | 1129 | ||
1131 | if (rsc != NULL) | 1130 | if (rsc != NULL) |
1132 | hfsc_change_rsc(cl, rsc, 0); | 1131 | hfsc_change_rsc(cl, rsc, 0); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index cc5f339e6f91..880a3394a51f 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
@@ -1559,10 +1559,9 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
1559 | goto failure; | 1559 | goto failure; |
1560 | } | 1560 | } |
1561 | err = -ENOBUFS; | 1561 | err = -ENOBUFS; |
1562 | if ((cl = kmalloc(sizeof(*cl), GFP_KERNEL)) == NULL) | 1562 | if ((cl = kzalloc(sizeof(*cl), GFP_KERNEL)) == NULL) |
1563 | goto failure; | 1563 | goto failure; |
1564 | 1564 | ||
1565 | memset(cl, 0, sizeof(*cl)); | ||
1566 | cl->refcnt = 1; | 1565 | cl->refcnt = 1; |
1567 | INIT_LIST_HEAD(&cl->sibling); | 1566 | INIT_LIST_HEAD(&cl->sibling); |
1568 | INIT_LIST_HEAD(&cl->hlist); | 1567 | INIT_LIST_HEAD(&cl->hlist); |
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index c5bd8064e6d8..a08ec4c7c55d 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -148,7 +148,8 @@ static long tabledist(unsigned long mu, long sigma, | |||
148 | static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 148 | static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
149 | { | 149 | { |
150 | struct netem_sched_data *q = qdisc_priv(sch); | 150 | struct netem_sched_data *q = qdisc_priv(sch); |
151 | struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb; | 151 | /* We don't fill cb now as skb_unshare() may invalidate it */ |
152 | struct netem_skb_cb *cb; | ||
152 | struct sk_buff *skb2; | 153 | struct sk_buff *skb2; |
153 | int ret; | 154 | int ret; |
154 | int count = 1; | 155 | int count = 1; |
@@ -200,6 +201,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
200 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 201 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
201 | } | 202 | } |
202 | 203 | ||
204 | cb = (struct netem_skb_cb *)skb->cb; | ||
203 | if (q->gap == 0 /* not doing reordering */ | 205 | if (q->gap == 0 /* not doing reordering */ |
204 | || q->counter < q->gap /* inside last reordering gap */ | 206 | || q->counter < q->gap /* inside last reordering gap */ |
205 | || q->reorder < get_crandom(&q->reorder_cor)) { | 207 | || q->reorder < get_crandom(&q->reorder_cor)) { |