[NET_SCHED]: sch_api: introduce constant for rate table size
[safe/jmp/linux-2.6] / net / sched / sch_hfsc.c
index 4e6a164..10a2f35 100644 (file)
@@ -997,10 +997,15 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
        struct nlattr *tb[TCA_HFSC_MAX + 1];
        struct tc_service_curve *rsc = NULL, *fsc = NULL, *usc = NULL;
        u64 cur_time;
+       int err;
 
-       if (opt == NULL || nla_parse_nested(tb, TCA_HFSC_MAX, opt, NULL))
+       if (opt == NULL)
                return -EINVAL;
 
+       err = nla_parse_nested(tb, TCA_HFSC_MAX, opt, NULL);
+       if (err < 0)
+               return err;
+
        if (tb[TCA_HFSC_RSC]) {
                if (nla_len(tb[TCA_HFSC_RSC]) < sizeof(*rsc))
                        return -EINVAL;
@@ -1338,22 +1343,23 @@ hfsc_dump_class(struct Qdisc *sch, unsigned long arg, struct sk_buff *skb,
                struct tcmsg *tcm)
 {
        struct hfsc_class *cl = (struct hfsc_class *)arg;
-       unsigned char *b = skb_tail_pointer(skb);
-       struct nlattr *nla = (struct nlattr *)b;
+       struct nlattr *nest;
 
        tcm->tcm_parent = cl->cl_parent ? cl->cl_parent->classid : TC_H_ROOT;
        tcm->tcm_handle = cl->classid;
        if (cl->level == 0)
                tcm->tcm_info = cl->qdisc->handle;
 
-       NLA_PUT(skb, TCA_OPTIONS, 0, NULL);
+       nest = nla_nest_start(skb, TCA_OPTIONS);
+       if (nest == NULL)
+               goto nla_put_failure;
        if (hfsc_dump_curves(skb, cl) < 0)
                goto nla_put_failure;
-       nla->nla_len = skb_tail_pointer(skb) - b;
+       nla_nest_end(skb, nest);
        return skb->len;
 
  nla_put_failure:
-       nlmsg_trim(skb, b);
+       nla_nest_cancel(skb, nest);
        return -1;
 }