linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / net / sched / sch_hfsc.c
index 6a6735a..91132f6 100644 (file)
@@ -50,6 +50,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/errno.h>
@@ -973,10 +974,10 @@ hfsc_adjust_levels(struct hfsc_class *cl)
        do {
                level = 0;
                list_for_each_entry(p, &cl->children, siblings) {
-                       if (p->level >= level)
-                               level = p->level + 1;
+                       if (p->level > level)
+                               level = p->level;
                }
-               cl->level = level;
+               cl->level = level + 1;
        } while ((cl = cl->cl_parent) != NULL);
 }
 
@@ -1123,9 +1124,10 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
        if (rsc == NULL && fsc == NULL)
                return -EINVAL;
 
-       cl = kzalloc(sizeof(struct hfsc_class), GFP_KERNEL);
+       cl = kmalloc(sizeof(struct hfsc_class), GFP_KERNEL);
        if (cl == NULL)
                return -ENOBUFS;
+       memset(cl, 0, sizeof(struct hfsc_class));
 
        if (rsc != NULL)
                hfsc_change_rsc(cl, rsc, 0);