From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757274AbbJHMab (ORCPT ); Thu, 8 Oct 2015 08:30:31 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:52495 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754471AbbJHMa3 (ORCPT ); Thu, 8 Oct 2015 08:30:29 -0400 From: Arnd Bergmann To: Pablo Neira Ayuso , netfilter-devel@vger.kernel.org Cc: "Eric W. Biederman" , Florian Westphal , pablo@netfilter.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] bridge/netfilter: avoid unused label warning Date: Thu, 08 Oct 2015 14:30:15 +0200 Message-ID: <5180534.sSnu9AX8xS@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:NyPBeCzbB0EcJatVWRf6J/rg0D/dwVg7aiSSqMZBhD01Wje++Iy OahwDxkQ03pomkE/NXalKfAbl5D0OTw+BMCpyV1IlmGzj3gxFVPvS64nmMKOGZOnXQmnRjG Dj0VIBhVFCmtG7Or4fBpUJeWJ0RPg5E/x7XVFEMGFe9BU/2WLzASO1S4IGk758DF2BRCX3q UxSyhFfnbiF/fzyaJOECw== X-UI-Out-Filterresults: notjunk:1;V01:K0:KCnslNv/5wk=:gs00EPqjAt+PpYD8be1WXc 9kdaKdlexYXvLCQ0Xi/+GgzWzoTKWg6F0HIbk8runnomfkZZYFybNfILWbOlE41rrA/X9Qyss ab00v0itfrJOQmMZVsxBHKN2HMqS9Ae+i/FiUN1tykCGyYyBmNt2+gh+3YmZ63nApUXWmPMda Rnm4PwTE1re+PF+J7xd6oARRQso6CmIKIjMbx4bc8Q0SP3JARAXt/pFgUDzojzTKqmHBTcLWn ONdxTP3bLBQLuFWjb8UtDs2s699JeWmHDDv0olppSFW3m35cF/sSRqG1gc+HXdHSDmA0wcnR4 g+JBJOCMbEgnEIp6bnog5vcS9dRh9SAy//V8EkILc1nQ9v6DztxGgl77hxOWGw5elRnjHE9j1 zicz0qfYMCe3VokAKMvsl0pBsCo8CFjHuMmzuAhwi0jgrxS6ivsrfETnaRwQelx2ScICakID5 cGeIDIVZE83yyuIwu8cEOqecxR1cSTxUx2UUvcxy/QkBB7zyNR4ml1oJOjsOrHy2lSkxqbckV 5ZCx5FcwxnQqivtLG0wIpgPMULXIqxX8KGfBEbUrza1EXMe/+TIFi1NRXZeDLdMpJvQ7nOm+F idr76wnt2ZNw1LgHqsax0rpGKyZm+sBIIT/rLNm5/cvfBaeDkXayVOUuKtgncK84lYHj7eKRW L6NfrAKuLs2KiuoP/39y+yL7m9FVPvoVp3zVqXwKp8iOga7PU+qVVR+YjpNITpe3V0/c9dAdg z6pfMj4vhR8sNMsY Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the ARM mini2440_defconfig, the bridge netfilter code gets built with both CONFIG_NF_DEFRAG_IPV4 and CONFIG_NF_DEFRAG_IPV6 disabled, which leads to a harmless gcc warning: net/bridge/br_netfilter_hooks.c: In function 'br_nf_dev_queue_xmit': net/bridge/br_netfilter_hooks.c:792:2: warning: label 'drop' defined but not used [-Wunused-label] This gets rid of the warning by cleaning up the code to avoid the respective #ifdefs causing this problem, and replacing them with if(IS_ENABLED()) checks. I have verified that the resulting object code is unchanged, and an additional advantage is that we now get compile coverage of the unused functions in more configurations. Signed-off-by: Arnd Bergmann Fixes: dd302b59bde0 ("netfilter: bridge: don't leak skb in error paths") --- Version 2: Rebased to git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c index 13f03671c88d..18905d4781db 100644 --- a/net/bridge/br_netfilter_hooks.c +++ b/net/bridge/br_netfilter_hooks.c @@ -111,7 +111,6 @@ static inline __be16 pppoe_proto(const struct sk_buff *skb) /* largest possible L2 header, see br_nf_dev_queue_xmit() */ #define NF_BRIDGE_MAX_MAC_HEADER_LENGTH (PPPOE_SES_HLEN + ETH_HLEN) -#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) || IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) struct brnf_frag_data { char mac[NF_BRIDGE_MAX_MAC_HEADER_LENGTH]; u8 encap_size; @@ -121,7 +120,6 @@ struct brnf_frag_data { }; static DEFINE_PER_CPU(struct brnf_frag_data, brnf_frag_data_storage); -#endif static void nf_bridge_info_free(struct sk_buff *skb) { @@ -666,7 +664,6 @@ static unsigned int br_nf_forward_arp(void *priv, return NF_STOLEN; } -#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) || IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff *skb) { struct brnf_frag_data *data; @@ -696,9 +693,7 @@ static int br_nf_push_frag_xmit_sk(struct sock *sk, struct sk_buff *skb) struct net *net = dev_net(skb_dst(skb)->dev); return br_nf_push_frag_xmit(net, sk, skb); } -#endif -#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) static int br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, int (*output)(struct sock *, struct sk_buff *)) @@ -716,7 +711,6 @@ br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, return ip_do_fragment(sk, skb, output); } -#endif static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb) { @@ -739,11 +733,11 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff nf_bridge = nf_bridge_info_get(skb); -#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) /* This is wrong! We should preserve the original fragment * boundaries by preserving frag_list rather than refragmenting. */ - if (skb->protocol == htons(ETH_P_IP)) { + if (IS_ENABLED(CONFIG_NF_DEFRAG_IPV4) && + skb->protocol == htons(ETH_P_IP)) { struct brnf_frag_data *data; if (br_validate_ipv4(net, skb)) @@ -765,9 +759,8 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff return br_nf_ip_fragment(net, sk, skb, br_nf_push_frag_xmit_sk); } -#endif -#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) - if (skb->protocol == htons(ETH_P_IPV6)) { + if (IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) && + skb->protocol == htons(ETH_P_IPV6)) { const struct nf_ipv6_ops *v6ops = nf_get_ipv6_ops(); struct brnf_frag_data *data; @@ -791,7 +784,6 @@ static int br_nf_dev_queue_xmit(struct net *net, struct sock *sk, struct sk_buff kfree_skb(skb); return -EMSGSIZE; } -#endif nf_bridge_info_free(skb); return br_dev_queue_push_xmit(net, sk, skb); drop: