From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiri Pirko Subject: Re: [PATCH net v2] net: sched: cls_flower: validate nested enc_opts_policy to avoid warning Date: Sat, 10 Nov 2018 08:18:03 +0100 Message-ID: <20181110071803.GB2019@nanopsycho.orion> References: <20181110050626.6659-1-jakub.kicinski@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: davem@davemloft.net, oss-drivers@netronome.com, netdev@vger.kernel.org To: Jakub Kicinski Return-path: Received: from mail-wm1-f50.google.com ([209.85.128.50]:55791 "EHLO mail-wm1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728644AbeKJRI2 (ORCPT ); Sat, 10 Nov 2018 12:08:28 -0500 Received: by mail-wm1-f50.google.com with SMTP id s10-v6so3916479wmc.5 for ; Fri, 09 Nov 2018 23:24:27 -0800 (PST) Content-Disposition: inline In-Reply-To: <20181110050626.6659-1-jakub.kicinski@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: Sat, Nov 10, 2018 at 06:06:26AM CET, jakub.kicinski@netronome.com wrote: >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. > >Signed-off-by: Jakub Kicinski >Acked-by: Simon Horman Fixes: 0a6e77784f49 ("net/sched: allow flower to match tunnel options") Acked-by: Jiri Pirko