diff options
Diffstat (limited to 'net/sched/cls_tcindex.c')
-rw-r--r-- | net/sched/cls_tcindex.c | 12 |
1 files changed, 4 insertions, 8 deletions
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]) { |