Re: [can:master 239/293] net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:231: warning: passing argument 4 of 'NF_HOOK_THRESH' discards qualifiers from pointer target type
From: Fengguang Wu <hidden>
Date: 2012-09-20 07:34:39
Also in:
kernel-janitors
On Thu, Sep 20, 2012 at 09:14:02AM +0200, Patrick McHardy wrote:
On Tue, 11 Sep 2012, Patrick McHardy wrote:quoted
On Fri, 7 Sep 2012, Fengguang Wu wrote:quoted
Hi Patrick, FYI, there are new compile warnings show up in tree: git://gitorious.org/linux-can/linux-can-next master head: bbe660a7ddf32dfe80753c6722e141bf7e4bf5d8 commit: 4cdd34084d539c758d00c5dc7bf95db2e4f2bc70 [239/293] netfilter: nf_conntrack_ipv6: improve fragmentation handling config: avr32-atngw100_defconfig (attached as .config) All error/warnings: net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c: In function '__ipv6_conntrack_in': net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:231: warning: passing argument 4 of 'NF_HOOK_THRESH' discards qualifiers from pointer target type net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:231: warning: passing argument 5 of 'NF_HOOK_THRESH' discards qualifiers from pointer target typeThanks, I'll look into this.It seems the cure for this is worse than the problem. The code currently casts the const struct net_device pointer to non-const for the NF_HOOK_THRES call. To avoid the cast we'd have to change all netfilter hooks to take a non-const pointer. The alternative would be to change the NF_HOOK functions to also take a const struct net_device pointer, but that would require the same cast to non-const for nf_queue, which uses dev_hold() and dev_put(), so this would effectively just move the warning to a different place. nf_queue is a quite special case, normally netfilter hooks shouln't be changing anything on the net_device, so I don't want to unconstify the arguments. The compiler actually shouldn't warn about this since its an explicit cast. I know some older versions of gcc did this, but there's no warning with current versions of gcc and the same casts are already present in other parts of IPv6 conntrack.
Yes, the avr32 builds are using an old gcc. Please ignore this warning. I'll teach the build system to ignore this class of warning on older gcc. Thanks, Fengguang