linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / sched / act_police.c
index 930e010..f304b1b 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <linux/bitops.h>
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
@@ -77,7 +78,7 @@ static __inline__ struct tcf_police * tcf_police_lookup(u32 index)
 }
 
 #ifdef CONFIG_NET_CLS_ACT
-static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *cb,
+static int tcf_generic_walker(struct sk_buff *skb, struct netlink_callback *cb,
                               int type, struct tc_action *a)
 {
        struct tcf_police *p;
@@ -124,7 +125,7 @@ rtattr_failure:
 }
 
 static inline int
-tcf_act_police_hash_search(struct tc_action *a, u32 index)
+tcf_hash_search(struct tc_action *a, u32 index)
 {
        struct tcf_police *p = tcf_police_lookup(index);
 
@@ -211,9 +212,10 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
                return ret;
        }
 
-       p = kzalloc(sizeof(*p), GFP_KERNEL);
+       p = kmalloc(sizeof(*p), GFP_KERNEL);
        if (p == NULL)
                return -ENOMEM;
+       memset(p, 0, sizeof(*p));
 
        ret = ACT_P_CREATED;
        p->refcnt = 1;
@@ -400,9 +402,9 @@ static struct tc_action_ops act_police_ops = {
        .act            =       tcf_act_police,
        .dump           =       tcf_act_police_dump,
        .cleanup        =       tcf_act_police_cleanup,
-       .lookup         =       tcf_act_police_hash_search,
+       .lookup         =       tcf_hash_search,
        .init           =       tcf_act_police_locate,
-       .walk           =       tcf_act_police_walker
+       .walk           =       tcf_generic_walker
 };
 
 static int __init
@@ -446,10 +448,11 @@ struct tcf_police * tcf_police_locate(struct rtattr *rta, struct rtattr *est)
                return p;
        }
 
-       p = kzalloc(sizeof(*p), GFP_KERNEL);
+       p = kmalloc(sizeof(*p), GFP_KERNEL);
        if (p == NULL)
                return NULL;
 
+       memset(p, 0, sizeof(*p));
        p->refcnt = 1;
        spin_lock_init(&p->lock);
        p->stats_lock = &p->lock;