X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fsched%2Fsch_hfsc.c;fp=net%2Fsched%2Fsch_hfsc.c;h=91132f6871d76ee42fa4e9dc53fcf643b32b779d;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=6a6735a2ed355b9640e654b28a5ecb96f69906e8;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 6a6735a2e..91132f687 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -50,6 +50,7 @@ */ #include +#include #include #include #include @@ -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);