From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758986AbbJISgY (ORCPT ); Fri, 9 Oct 2015 14:36:24 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:43849 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752845AbbJISgW (ORCPT ); Fri, 9 Oct 2015 14:36:22 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Arnd Bergmann Cc: Pablo Neira Ayuso , Patrick McHardy , Jozsef Kadlecsik , netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kernel@vger.kernel.org, "David S. Miller" , netdev@vger.kernel.org References: <7665226.mEs2QJDTOT@wuerfel> Date: Fri, 09 Oct 2015 13:28:23 -0500 In-Reply-To: <7665226.mEs2QJDTOT@wuerfel> (Arnd Bergmann's message of "Fri, 09 Oct 2015 14:45:20 +0200") Message-ID: <87zizryjzs.fsf@x220.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-AID: U2FsdGVkX1/LTeuSV3T+Q48CFjQZIZ7znXrJ7yOz9Qc= X-SA-Exim-Connect-IP: 67.3.201.231 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa06 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa06 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Arnd Bergmann X-Spam-Relay-Country: X-Spam-Timing: total 312 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 3.6 (1.2%), b_tie_ro: 2.7 (0.9%), parse: 1.10 (0.4%), extract_message_metadata: 14 (4.5%), get_uri_detail_list: 2.1 (0.7%), tests_pri_-1000: 6 (2.0%), tests_pri_-950: 1.36 (0.4%), tests_pri_-900: 1.12 (0.4%), tests_pri_-400: 28 (9.1%), check_bayes: 27 (8.6%), b_tokenize: 11 (3.6%), b_tok_get_all: 7 (2.3%), b_comp_prob: 3.0 (1.0%), b_tok_touch_all: 3.1 (1.0%), b_finish: 0.76 (0.2%), tests_pri_0: 248 (79.7%), tests_pri_500: 3.7 (1.2%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH] netfilter: turn NF_HOOK into an inline function X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Wed, 24 Sep 2014 11:00:52 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > A recent change to the dst_output handling caused a new warning > when the call to NF_HOOK() is the only used of a local variable > passed as 'dev', and CONFIG_NETFILTER is disabled: > > net/ipv6/ip6_output.c: In function 'ip6_output': > net/ipv6/ip6_output.c:135:21: warning: unused variable 'dev' [-Wunused-variable] > > The reason for this is that the NF_HOOK macro in this case does > not reference the variable at all. To avoid that warning now > and in the future, this changes the macro into an equivalent > inline function, which tells the compiler that the variable is > passed correctly but still unused. For clarification the actual change that trigger this is I passed in net instead of computing net as net = dev_net(dev). Which was the second use of the dev variable. > Signed-off-by: Arnd Bergmann > Fixes: ede2059dbaf9 ("dst: Pass net into dst->output") > > diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h > index edb3dc32f1da..1ff5c3f82820 100644 > --- a/include/linux/netfilter.h > +++ b/include/linux/netfilter.h > @@ -347,8 +347,23 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) > } > > #else /* !CONFIG_NETFILTER */ > -#define NF_HOOK(pf, hook, net, sk, skb, indev, outdev, okfn) (okfn)(net, sk, skb) > -#define NF_HOOK_COND(pf, hook, net, sk, skb, indev, outdev, okfn, cond) (okfn)(net, sk, skb) > +static inline int > +NF_HOOK_COND(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, > + struct sk_buff *skb, struct net_device *in, struct net_device *out, > + int (*okfn)(struct net *, struct sock *, struct sk_buff *), > + bool cond) > +{ > + return okfn(net, sk, skb); > +} > + > +static inline int > +NF_HOOK(uint8_t pf, unsigned int hook, struct net *net, struct sock *sk, struct sk_buff *skb, > + struct net_device *in, struct net_device *out, > + int (*okfn)(struct net *, struct sock *, struct sk_buff *)) > +{ > + return okfn(net, sk, skb); > +} > + > static inline int nf_hook(u_int8_t pf, unsigned int hook, struct net *net, > struct sock *sk, struct sk_buff *skb, > struct net_device *indev, struct net_device *outdev,