diff mbox series

[net-next] cls_flower: remove mpls_opts_policy

Message ID 4158adb2a6a49cd652f3ad47d59f2a976b6c1d18.1590864517.git.gnault@redhat.com
State Accepted
Delegated to: David Miller
Headers show
Series [net-next] cls_flower: remove mpls_opts_policy | expand

Commit Message

Guillaume Nault May 30, 2020, 6:49 p.m. UTC
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 <lkp@intel.com>
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 net/sched/cls_flower.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

David Miller June 1, 2020, 7:01 p.m. UTC | #1
From: Guillaume Nault <gnault@redhat.com>
Date: Sat, 30 May 2020 20:49:56 +0200

> 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 <lkp@intel.com>
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Applied, thank you.
diff mbox series

Patch

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 96f5999281e0..8f010cff03a6 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -727,11 +727,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 },