* [PATCH] bridge/netfilter: avoid unused label warning
@ 2015-10-06 19:22 Arnd Bergmann
2015-10-06 19:28 ` Nikolay Aleksandrov
2015-10-08 11:42 ` David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-10-06 19:22 UTC (permalink / raw)
To: netdev
Cc: David Miller, Florian Westphal, Pablo Neira Ayuso,
Eric W. Biederman, linux-arm-kernel, linux-kernel
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 <arnd@arndb.de>
Fixes: dd302b59bde0 ("netfilter: bridge: don't leak skb in error paths")
diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
index 370aa4d4cf4d..5c679ac5cdef 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;
@@ -691,9 +688,7 @@ static int br_nf_push_frag_xmit(struct net *net, struct sock *sk, struct sk_buff
nf_bridge_info_free(skb);
return br_dev_queue_push_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 net *, struct sock *, struct sk_buff *))
@@ -711,7 +706,6 @@ br_nf_ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
return ip_do_fragment(net, sk, skb, output);
}
-#endif
static unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
{
@@ -734,11 +728,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))
@@ -760,9 +754,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);
}
-#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;
@@ -786,7 +779,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:
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge/netfilter: avoid unused label warning
2015-10-06 19:22 [PATCH] bridge/netfilter: avoid unused label warning Arnd Bergmann
@ 2015-10-06 19:28 ` Nikolay Aleksandrov
2015-10-06 19:39 ` Arnd Bergmann
2015-10-08 11:42 ` David Miller
1 sibling, 1 reply; 6+ messages in thread
From: Nikolay Aleksandrov @ 2015-10-06 19:28 UTC (permalink / raw)
To: Arnd Bergmann, netdev
Cc: David Miller, Florian Westphal, Pablo Neira Ayuso,
Eric W. Biederman, linux-arm-kernel, linux-kernel
On 10/06/2015 09:22 PM, Arnd Bergmann wrote:
> 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 <arnd@arndb.de>
> Fixes: dd302b59bde0 ("netfilter: bridge: don't leak skb in error paths")
>
I posted a fix for this a couple of days ago, but I like your approach better.
Since mine is not yet applied (I sent it to netfilter-devel only, wasn't sure which
jurisdiction this falls into exactly) we can drop it.
Just for reference my patch is here:
http://patchwork.ozlabs.org/patch/526417/
Pablo, could you please drop it ?
By the way this takes care of another warning about unused variable (nf_bridge), too.
So,
Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge/netfilter: avoid unused label warning
2015-10-06 19:28 ` Nikolay Aleksandrov
@ 2015-10-06 19:39 ` Arnd Bergmann
2015-10-06 21:02 ` Nikolay Aleksandrov
0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2015-10-06 19:39 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Nikolay Aleksandrov, netdev, Florian Westphal, linux-kernel,
Pablo Neira Ayuso, David Miller, Eric W. Biederman
On Tuesday 06 October 2015 21:28:29 Nikolay Aleksandrov wrote:
> I posted a fix for this a couple of days ago, but I like your approach better.
> Since mine is not yet applied (I sent it to netfilter-devel only, wasn't sure which
> jurisdiction this falls into exactly) we can drop it.
> Just for reference my patch is here:
> http://patchwork.ozlabs.org/patch/526417/
> Pablo, could you please drop it ?
>
> By the way this takes care of another warning about unused variable (nf_bridge), too.
Hmm I did not get that one, at least not in 4.3-rc4.
> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Thanks and sorry for missing the Cc to the netfilter list on my patch.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge/netfilter: avoid unused label warning
2015-10-06 19:39 ` Arnd Bergmann
@ 2015-10-06 21:02 ` Nikolay Aleksandrov
0 siblings, 0 replies; 6+ messages in thread
From: Nikolay Aleksandrov @ 2015-10-06 21:02 UTC (permalink / raw)
To: Arnd Bergmann, linux-arm-kernel
Cc: netdev, Florian Westphal, linux-kernel, Pablo Neira Ayuso,
David Miller, Eric W. Biederman
On 10/06/2015 09:39 PM, Arnd Bergmann wrote:
> On Tuesday 06 October 2015 21:28:29 Nikolay Aleksandrov wrote:
>> I posted a fix for this a couple of days ago, but I like your approach better.
>> Since mine is not yet applied (I sent it to netfilter-devel only, wasn't sure which
>> jurisdiction this falls into exactly) we can drop it.
>> Just for reference my patch is here:
>> http://patchwork.ozlabs.org/patch/526417/
>> Pablo, could you please drop it ?
>>
>> By the way this takes care of another warning about unused variable (nf_bridge), too.
>
> Hmm I did not get that one, at least not in 4.3-rc4.
>
You need to set W=1
$ git describe --abbrev=0
v4.3-rc4
net/bridge//br_netfilter_hooks.c: In function ‘br_nf_dev_queue_xmit’:
net/bridge//br_netfilter_hooks.c:794:2: warning: label ‘drop’ defined but not used [-Wunused-label]
drop:
^
net/bridge//br_netfilter_hooks.c:727:25: warning: variable ‘nf_bridge’ set but not used [-Wunused-but-set-variable]
struct nf_bridge_info *nf_bridge;
Cheers,
Nik
>> Reviewed-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
>
> Thanks and sorry for missing the Cc to the netfilter list on my patch.
>
> Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge/netfilter: avoid unused label warning
2015-10-06 19:22 [PATCH] bridge/netfilter: avoid unused label warning Arnd Bergmann
2015-10-06 19:28 ` Nikolay Aleksandrov
@ 2015-10-08 11:42 ` David Miller
2015-10-08 12:30 ` Arnd Bergmann
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2015-10-08 11:42 UTC (permalink / raw)
To: arnd; +Cc: netdev, fw, pablo, ebiederm, linux-arm-kernel, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 06 Oct 2015 21:22:12 +0200
> 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 <arnd@arndb.de>
> Fixes: dd302b59bde0 ("netfilter: bridge: don't leak skb in error paths")
This commit is in v4.2-rc3 and later, but this patch only applies to net-next
as far as I can tell.
Wouldn't it be better to base this on 'net', or even better Pablo's netfilter
fixes tree, and while you are at it submit it properly to netfilter-devel
with Pablo CC:'d as well?
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bridge/netfilter: avoid unused label warning
2015-10-08 11:42 ` David Miller
@ 2015-10-08 12:30 ` Arnd Bergmann
0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2015-10-08 12:30 UTC (permalink / raw)
To: linux-arm-kernel; +Cc: David Miller, pablo, netdev, fw, linux-kernel, ebiederm
On Thursday 08 October 2015 04:42:53 David Miller wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> Date: Tue, 06 Oct 2015 21:22:12 +0200
>
> > 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 <arnd@arndb.de>
> > Fixes: dd302b59bde0 ("netfilter: bridge: don't leak skb in error paths")
>
> This commit is in v4.2-rc3 and later, but this patch only applies to net-next
> as far as I can tell.
>
> Wouldn't it be better to base this on 'net', or even better Pablo's netfilter
> fixes tree, and while you are at it submit it properly to netfilter-devel
> with Pablo CC:'d as well?
Ok, done.
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-10-08 12:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 19:22 [PATCH] bridge/netfilter: avoid unused label warning Arnd Bergmann
2015-10-06 19:28 ` Nikolay Aleksandrov
2015-10-06 19:39 ` Arnd Bergmann
2015-10-06 21:02 ` Nikolay Aleksandrov
2015-10-08 11:42 ` David Miller
2015-10-08 12:30 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).