]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: sched: cls_flower: validate nested enc_opts_policy to avoid warning
authorJakub Kicinski <jakub.kicinski@netronome.com>
Sat, 10 Nov 2018 05:06:26 +0000 (21:06 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sat, 10 Nov 2018 17:55:30 +0000 (09:55 -0800)
commit63c82997f5c0f3e1b914af43d82f712a86bc5f3a
tree3dd9b105864ea32548a209750147878f0bfe78fa
parentfbd1d5245372e48b494120a30fe0b34b304576c4
net: sched: cls_flower: validate nested enc_opts_policy to avoid warning

TCA_FLOWER_KEY_ENC_OPTS and TCA_FLOWER_KEY_ENC_OPTS_MASK can only
currently contain further nested attributes, which are parsed by
hand, so the policy is never actually used resulting in a W=1
build warning:

net/sched/cls_flower.c:492:1: warning: ‘enc_opts_policy’ defined but not used [-Wunused-const-variable=]
 enc_opts_policy[TCA_FLOWER_KEY_ENC_OPTS_MAX + 1] = {

Add the validation anyway to avoid potential bugs when other
attributes are added and to make the attribute structure slightly
more clear.  Validation will also set extact to point to bad
attribute on error.

Fixes: 0a6e77784f49 ("net/sched: allow flower to match tunnel options")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/cls_flower.c