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)
{
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]);
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);