X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fsched%2Fcls_tcindex.c;h=9f921174c8ab39d33e9544c9b78051b3b8a12cdf;hb=9464c7cf61b9433057924c36e6e02f303a00e768;hp=5af8a59e1503c7d5a90cf332af72ee5921d94950;hpb=41689045f6a3cbe0550e1d34e9cc20d2e8c432ba;p=linux-2.6.git diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c index 5af8a59e1..9f921174c 100644 --- a/net/sched/cls_tcindex.c +++ b/net/sched/cls_tcindex.c @@ -4,6 +4,7 @@ * Written 1998,1999 by Werner Almesberger, EPFL ICA */ +#include #include #include #include @@ -148,10 +149,11 @@ static int tcindex_init(struct tcf_proto *tp) struct tcindex_data *p; DPRINTK("tcindex_init(tp %p)\n",tp); - p = kzalloc(sizeof(struct tcindex_data),GFP_KERNEL); + p = kmalloc(sizeof(struct tcindex_data),GFP_KERNEL); if (!p) return -ENOMEM; + memset(p, 0, sizeof(*p)); p->mask = 0xffff; p->hash = DEFAULT_HASH_SIZE; p->fall_through = 1; @@ -295,14 +297,16 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, err = -ENOMEM; if (!cp.perfect && !cp.h) { if (valid_perfect_hash(&cp)) { - cp.perfect = kcalloc(cp.hash, sizeof(*r), GFP_KERNEL); + cp.perfect = kmalloc(cp.hash * sizeof(*r), GFP_KERNEL); if (!cp.perfect) goto errout; + memset(cp.perfect, 0, cp.hash * sizeof(*r)); balloc = 1; } else { - cp.h = kcalloc(cp.hash, sizeof(f), GFP_KERNEL); + cp.h = kmalloc(cp.hash * sizeof(f), GFP_KERNEL); if (!cp.h) goto errout; + memset(cp.h, 0, cp.hash * sizeof(f)); balloc = 2; } } @@ -313,9 +317,10 @@ tcindex_set_parms(struct tcf_proto *tp, unsigned long base, u32 handle, r = tcindex_lookup(&cp, handle) ? : &new_filter_result; if (r == &new_filter_result) { - f = kzalloc(sizeof(*f), GFP_KERNEL); + f = kmalloc(sizeof(*f), GFP_KERNEL); if (!f) goto errout_alloc; + memset(f, 0, sizeof(*f)); } if (tb[TCA_TCINDEX_CLASSID-1]) {