diff options
Diffstat (limited to 'net/sched/cls_tcindex.c')
| -rw-r--r-- | net/sched/cls_tcindex.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 9f921174c8ab..5af8a59e1503 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c | |||
| @@ -4,7 +4,6 @@ | |||
| 4 | * Written 1998,1999 by Werner Almesberger, EPFL ICA | 4 | * Written 1998,1999 by Werner Almesberger, EPFL ICA |
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/config.h> | ||
| 8 | #include <linux/module.h> | 7 | #include <linux/module.h> |
| 9 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 10 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| @@ -149,11 +148,10 @@ static int tcindex_init(struct tcf_proto *tp) | |||
| 149 | struct tcindex_data *p; | 148 | struct tcindex_data *p; |
| 150 | 149 | ||
| 151 | DPRINTK("tcindex_init(tp %p)\n",tp); | 150 | DPRINTK("tcindex_init(tp %p)\n",tp); |
| 152 | p = kmalloc(sizeof(struct tcindex_data),GFP_KERNEL); | 151 | p = kzalloc(sizeof(struct tcindex_data),GFP_KERNEL); |
| 153 | if (!p) | 152 | if (!p) |
| 154 | return -ENOMEM; | 153 | return -ENOMEM; |
| 155 | 154 | ||
| 156 | memset(p, 0, sizeof(*p)); | ||
| 157 | p->mask = 0xffff; | 155 | p->mask = 0xffff; |
| 158 | p->hash = DEFAULT_HASH_SIZE; | 156 | p->hash = DEFAULT_HASH_SIZE; |
| 159 | p->fall_through = 1; | 157 | p->fall_through = 1; |
| @@ -297,16 +295,14 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
| 297 | err = -ENOMEM; | 295 | err = -ENOMEM; |
| 298 | if (!cp.perfect && !cp.h) { | 296 | if (!cp.perfect && !cp.h) { |
| 299 | if (valid_perfect_hash(&cp)) { | 297 | if (valid_perfect_hash(&cp)) { |
| 300 | cp.perfect = kmalloc(cp.hash * sizeof(*r), GFP_KERNEL); | 298 | cp.perfect = kcalloc(cp.hash, sizeof(*r), GFP_KERNEL); |
| 301 | if (!cp.perfect) | 299 | if (!cp.perfect) |
| 302 | goto errout; | 300 | goto errout; |
| 303 | memset(cp.perfect, 0, cp.hash * sizeof(*r)); | ||
| 304 | balloc = 1; | 301 | balloc = 1; |
| 305 | } else { | 302 | } else { |
| 306 | cp.h = kmalloc(cp.hash * sizeof(f), GFP_KERNEL); | 303 | cp.h = kcalloc(cp.hash, sizeof(f), GFP_KERNEL); |
| 307 | if (!cp.h) | 304 | if (!cp.h) |
| 308 | goto errout; | 305 | goto errout; |
| 309 | memset(cp.h, 0, cp.hash * sizeof(f)); | ||
| 310 | balloc = 2; | 306 | balloc = 2; |
| 311 | } | 307 | } |
| 312 | } | 308 | } |
| @@ -317,10 +313,9 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, | |||
| 317 | r = tcindex_lookup(&cp, handle) ? : &new_filter_result; | 313 | r = tcindex_lookup(&cp, handle) ? : &new_filter_result; |
| 318 | 314 | ||
| 319 | if (r == &new_filter_result) { | 315 | if (r == &new_filter_result) { |
| 320 | f = kmalloc(sizeof(*f), GFP_KERNEL); | 316 | f = kzalloc(sizeof(*f), GFP_KERNEL); |
| 321 | if (!f) | 317 | if (!f) |
| 322 | goto errout_alloc; | 318 | goto errout_alloc; |
| 323 | memset(f, 0, sizeof(*f)); | ||
| 324 | } | 319 | } |
| 325 | 320 | ||
| 326 | if (tb[TCA_TCINDEX_CLASSID-1]) { | 321 | if (tb[TCA_TCINDEX_CLASSID-1]) { |
