diff options
Diffstat (limited to 'net/sched/cls_u32.c')
| -rw-r--r-- | net/sched/cls_u32.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c index 78e052591fa9..0a6cfa0005be 100644 --- a/net/sched/cls_u32.c +++ b/net/sched/cls_u32.c | |||
| @@ -33,7 +33,6 @@ | |||
| 33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
| 34 | #include <asm/system.h> | 34 | #include <asm/system.h> |
| 35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
| 36 | #include <linux/config.h> | ||
| 37 | #include <linux/module.h> | 36 | #include <linux/module.h> |
| 38 | #include <linux/types.h> | 37 | #include <linux/types.h> |
| 39 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
| @@ -308,23 +307,21 @@ static int u32_init(struct tcf_proto *tp) | |||
| 308 | if (tp_c->q == tp->q) | 307 | if (tp_c->q == tp->q) |
| 309 | break; | 308 | break; |
| 310 | 309 | ||
| 311 | root_ht = kmalloc(sizeof(*root_ht), GFP_KERNEL); | 310 | root_ht = kzalloc(sizeof(*root_ht), GFP_KERNEL); |
| 312 | if (root_ht == NULL) | 311 | if (root_ht == NULL) |
| 313 | return -ENOBUFS; | 312 | return -ENOBUFS; |
| 314 | 313 | ||
| 315 | memset(root_ht, 0, sizeof(*root_ht)); | ||
| 316 | root_ht->divisor = 0; | 314 | root_ht->divisor = 0; |
| 317 | root_ht->refcnt++; | 315 | root_ht->refcnt++; |
| 318 | root_ht->handle = tp_c ? gen_new_htid(tp_c) : 0x80000000; | 316 | root_ht->handle = tp_c ? gen_new_htid(tp_c) : 0x80000000; |
| 319 | root_ht->prio = tp->prio; | 317 | root_ht->prio = tp->prio; |
| 320 | 318 | ||
| 321 | if (tp_c == NULL) { | 319 | if (tp_c == NULL) { |
| 322 | tp_c = kmalloc(sizeof(*tp_c), GFP_KERNEL); | 320 | tp_c = kzalloc(sizeof(*tp_c), GFP_KERNEL); |
| 323 | if (tp_c == NULL) { | 321 | if (tp_c == NULL) { |
| 324 | kfree(root_ht); | 322 | kfree(root_ht); |
| 325 | return -ENOBUFS; | 323 | return -ENOBUFS; |
| 326 | } | 324 | } |
| 327 | memset(tp_c, 0, sizeof(*tp_c)); | ||
| 328 | tp_c->q = tp->q; | 325 | tp_c->q = tp->q; |
| 329 | tp_c->next = u32_list; | 326 | tp_c->next = u32_list; |
| 330 | u32_list = tp_c; | 327 | u32_list = tp_c; |
| @@ -572,10 +569,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
| 572 | if (handle == 0) | 569 | if (handle == 0) |
| 573 | return -ENOMEM; | 570 | return -ENOMEM; |
| 574 | } | 571 | } |
| 575 | ht = kmalloc(sizeof(*ht) + divisor*sizeof(void*), GFP_KERNEL); | 572 | ht = kzalloc(sizeof(*ht) + divisor*sizeof(void*), GFP_KERNEL); |
| 576 | if (ht == NULL) | 573 | if (ht == NULL) |
| 577 | return -ENOBUFS; | 574 | return -ENOBUFS; |
| 578 | memset(ht, 0, sizeof(*ht) + divisor*sizeof(void*)); | ||
| 579 | ht->tp_c = tp_c; | 575 | ht->tp_c = tp_c; |
| 580 | ht->refcnt = 0; | 576 | ht->refcnt = 0; |
| 581 | ht->divisor = divisor; | 577 | ht->divisor = divisor; |
| @@ -618,18 +614,16 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
| 618 | 614 | ||
| 619 | s = RTA_DATA(tb[TCA_U32_SEL-1]); | 615 | s = RTA_DATA(tb[TCA_U32_SEL-1]); |
| 620 | 616 | ||
| 621 | 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); |
| 622 | if (n == NULL) | 618 | if (n == NULL) |
| 623 | return -ENOBUFS; | 619 | return -ENOBUFS; |
| 624 | 620 | ||
| 625 | memset(n, 0, sizeof(*n) + s->nkeys*sizeof(struct tc_u32_key)); | ||
| 626 | #ifdef CONFIG_CLS_U32_PERF | 621 | #ifdef CONFIG_CLS_U32_PERF |
| 627 | 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); |
| 628 | if (n->pf == NULL) { | 623 | if (n->pf == NULL) { |
| 629 | kfree(n); | 624 | kfree(n); |
| 630 | return -ENOBUFS; | 625 | return -ENOBUFS; |
| 631 | } | 626 | } |
| 632 | memset(n->pf, 0, sizeof(struct tc_u32_pcnt) + s->nkeys*sizeof(u64)); | ||
| 633 | #endif | 627 | #endif |
| 634 | 628 | ||
| 635 | 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)); |
| @@ -802,7 +796,7 @@ static int __init init_u32(void) | |||
| 802 | { | 796 | { |
| 803 | printk("u32 classifier\n"); | 797 | printk("u32 classifier\n"); |
| 804 | #ifdef CONFIG_CLS_U32_PERF | 798 | #ifdef CONFIG_CLS_U32_PERF |
| 805 | printk(" Perfomance counters on\n"); | 799 | printk(" Performance counters on\n"); |
| 806 | #endif | 800 | #endif |
| 807 | #ifdef CONFIG_NET_CLS_POLICE | 801 | #ifdef CONFIG_NET_CLS_POLICE |
| 808 | printk(" OLD policer on \n"); | 802 | printk(" OLD policer on \n"); |
