diff options
Diffstat (limited to 'net/sched/cls_u32.c')
-rw-r--r-- | net/sched/cls_u32.c | 15 |
1 files changed, 5 insertions, 10 deletions
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)); |