]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sched/act_simple.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
[linux-2.6-omap-h63xx.git] / net / sched / act_simple.c
index d3226e24070b408ed953a6652a92377c328f2583..64b2d136c78e9ac1cf370e3289bed361de9995ff 100644 (file)
@@ -84,6 +84,10 @@ static int realloc_defdata(struct tcf_defact *d, u32 datalen, void *defdata)
        return alloc_defdata(d, datalen, defdata);
 }
 
+static const struct nla_policy simple_policy[TCA_DEF_MAX + 1] = {
+       [TCA_DEF_PARMS] = { .len = sizeof(struct tc_defact) },
+};
+
 static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
                         struct tc_action *a, int ovr, int bind)
 {
@@ -93,13 +97,16 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
        struct tcf_common *pc;
        void *defdata;
        u32 datalen = 0;
-       int ret = 0;
+       int ret = 0, err;
 
-       if (nla == NULL || nla_parse_nested(tb, TCA_DEF_MAX, nla, NULL) < 0)
+       if (nla == NULL)
                return -EINVAL;
 
-       if (tb[TCA_DEF_PARMS] == NULL ||
-           nla_len(tb[TCA_DEF_PARMS]) < sizeof(*parm))
+       err = nla_parse_nested(tb, TCA_DEF_MAX, nla, NULL);
+       if (err < 0)
+               return err;
+
+       if (tb[TCA_DEF_PARMS] == NULL)
                return -EINVAL;
 
        parm = nla_data(tb[TCA_DEF_PARMS]);
@@ -108,7 +115,7 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
                return -EINVAL;
 
        datalen = nla_len(tb[TCA_DEF_DATA]);
-       if (datalen <= 0)
+       if (datalen == 0)
                return -EINVAL;
 
        pc = tcf_hash_check(parm->index, a, bind, &simp_hash_info);