Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 79544
b: refs/heads/master
c: 7a9c1bd
h: refs/heads/master
v: v3
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jan 28, 2008
1 parent 0eed90a commit 109333e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53b2bf3f8a652c9c8e86831f94ae2c5767ea54d7
refs/heads/master: 7a9c1bd409d3522806d492aa573c1cc5384ca620
9 changes: 6 additions & 3 deletions trunk/net/sched/em_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,10 @@ static inline int meta_is_supported(struct meta_value *val)
return (!meta_id(val) || meta_ops(val)->get);
}

static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = {
[TCA_EM_META_HDR] = { .len = sizeof(struct tcf_meta_hdr) },
};

static int em_meta_change(struct tcf_proto *tp, void *data, int len,
struct tcf_ematch *m)
{
Expand All @@ -753,13 +757,12 @@ static int em_meta_change(struct tcf_proto *tp, void *data, int len,
struct tcf_meta_hdr *hdr;
struct meta_match *meta = NULL;

err = nla_parse(tb, TCA_EM_META_MAX, data, len, NULL);
err = nla_parse(tb, TCA_EM_META_MAX, data, len, meta_policy);
if (err < 0)
goto errout;

err = -EINVAL;
if (tb[TCA_EM_META_HDR] == NULL ||
nla_len(tb[TCA_EM_META_HDR]) < sizeof(*hdr))
if (tb[TCA_EM_META_HDR] == NULL)
goto errout;
hdr = nla_data(tb[TCA_EM_META_HDR]);

Expand Down
11 changes: 6 additions & 5 deletions trunk/net/sched/ematch.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ static int tcf_em_validate(struct tcf_proto *tp,
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
*
Expand Down Expand Up @@ -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;

Expand All @@ -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));

Expand Down

0 comments on commit 109333e

Please sign in to comment.