Skip to content

Commit

Permalink
net: remove the unnecessary strict_start_type in some policies
Browse files Browse the repository at this point in the history
ct_policy and mpls_policy are parsed with nla_parse_nested(), which
does NL_VALIDATE_STRICT validation, strict_start_type is not needed
to set as it is actually trying to make some attributes parsed with
NL_VALIDATE_STRICT.

This patch is to remove it, and do the same on rtm_nh_policy which
is parsed by nlmsg_parse().

Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Xin Long authored and David S. Miller committed Nov 21, 2019
1 parent ff998a8 commit f3bed7f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 3 deletions.
1 change: 0 additions & 1 deletion net/ipv4/nexthop.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ static void remove_nexthop(struct net *net, struct nexthop *nh,
#define NH_DEV_HASHSIZE (1U << NH_DEV_HASHBITS)

static const struct nla_policy rtm_nh_policy[NHA_MAX + 1] = {
[NHA_UNSPEC] = { .strict_start_type = NHA_UNSPEC + 1 },
[NHA_ID] = { .type = NLA_U32 },
[NHA_GROUP] = { .type = NLA_BINARY },
[NHA_GROUP_TYPE] = { .type = NLA_U16 },
Expand Down
1 change: 0 additions & 1 deletion net/sched/act_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a,
}

static const struct nla_policy ct_policy[TCA_CT_MAX + 1] = {
[TCA_CT_UNSPEC] = { .strict_start_type = TCA_CT_UNSPEC + 1 },
[TCA_CT_ACTION] = { .type = NLA_U16 },
[TCA_CT_PARMS] = { .type = NLA_EXACT_LEN, .len = sizeof(struct tc_ct) },
[TCA_CT_ZONE] = { .type = NLA_U16 },
Expand Down
1 change: 0 additions & 1 deletion net/sched/act_mpls.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ static int valid_label(const struct nlattr *attr,
}

static const struct nla_policy mpls_policy[TCA_MPLS_MAX + 1] = {
[TCA_MPLS_UNSPEC] = { .strict_start_type = TCA_MPLS_UNSPEC + 1 },
[TCA_MPLS_PARMS] = NLA_POLICY_EXACT_LEN(sizeof(struct tc_mpls)),
[TCA_MPLS_PROTO] = { .type = NLA_U16 },
[TCA_MPLS_LABEL] = NLA_POLICY_VALIDATE_FN(NLA_U32, valid_label),
Expand Down

0 comments on commit f3bed7f

Please sign in to comment.