Skip to content

Commit

Permalink
cls_flower: remove mpls_opts_policy
Browse files Browse the repository at this point in the history
Compiling with W=1 gives the following warning:
net/sched/cls_flower.c:731:1: warning: ‘mpls_opts_policy’ defined but not used [-Wunused-const-variable=]

The TCA_FLOWER_KEY_MPLS_OPTS contains a list of
TCA_FLOWER_KEY_MPLS_OPTS_LSE. Therefore, the attributes all have the
same type and we can't parse the list with nla_parse*() and have the
attributes validated automatically using an nla_policy.

fl_set_key_mpls_opts() properly verifies that all attributes in the
list are TCA_FLOWER_KEY_MPLS_OPTS_LSE. Then fl_set_key_mpls_lse()
uses nla_parse_nested() on all these attributes, thus verifying that
they have the NLA_F_NESTED flag. So we can safely drop the
mpls_opts_policy.

Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Guillaume Nault <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Guillaume Nault authored and davem330 committed Jun 1, 2020
1 parent 2a67ab9 commit 4e4f4ce
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions net/sched/cls_flower.c
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,6 @@ erspan_opt_policy[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_MAX + 1] = {
[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_HWID] = { .type = NLA_U8 },
};

static const struct nla_policy
mpls_opts_policy[TCA_FLOWER_KEY_MPLS_OPTS_MAX + 1] = {
[TCA_FLOWER_KEY_MPLS_OPTS_LSE] = { .type = NLA_NESTED },
};

static const struct nla_policy
mpls_stack_entry_policy[TCA_FLOWER_KEY_MPLS_OPT_LSE_MAX + 1] = {
[TCA_FLOWER_KEY_MPLS_OPT_LSE_DEPTH] = { .type = NLA_U8 },
Expand Down

0 comments on commit 4e4f4ce

Please sign in to comment.