summaryrefslogtreecommitdiffstats
path: root/net/sched/ematch.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-01-24 05:36:45 +0100
committerDavid S. Miller <davem@davemloft.net>2008-01-29 00:11:24 +0100
commit7a9c1bd409d3522806d492aa573c1cc5384ca620 (patch)
tree5226c9086d9f4418f91032bedae11cc0aba9c50d /net/sched/ematch.c
parent[NET_SCHED]: Use nla_policy for attribute validation in actions (diff)
downloadlinux-7a9c1bd409d3522806d492aa573c1cc5384ca620.tar.xz
linux-7a9c1bd409d3522806d492aa573c1cc5384ca620.zip
[NET_SCHED]: Use nla_policy for attribute validation in ematches
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/ematch.c')
-rw-r--r--net/sched/ematch.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index daa9c4e7e81d..74ff918455a2 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -282,6 +282,11 @@ errout:
return err;
}
+static const struct nla_policy em_policy[TCA_EMATCH_TREE_MAX + 1] = {
+ [TCA_EMATCH_TREE_HDR] = { .len = sizeof(struct tcf_ematch_tree_hdr) },
+ [TCA_EMATCH_TREE_LIST] = { .type = NLA_NESTED },
+};
+
/**
* tcf_em_tree_validate - validate ematch config TLV and build ematch tree
*
@@ -312,7 +317,7 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla,
return 0;
}
- err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, NULL);
+ err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy);
if (err < 0)
goto errout;
@@ -323,10 +328,6 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct nlattr *nla,
if (rt_hdr == NULL || rt_list == NULL)
goto errout;
- if (nla_len(rt_hdr) < sizeof(*tree_hdr) ||
- nla_len(rt_list) < sizeof(*rt_match))
- goto errout;
-
tree_hdr = nla_data(rt_hdr);
memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr));