linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Babrou <ivan@ivan.computer>
To: Daniel Xu <dxu@dxuuu.xyz>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Unused variable 'mark' in v6.1-rc7
Date: Sun, 27 Nov 2022 17:30:47 -0800	[thread overview]
Message-ID: <CAGjnhw_2oSWfMjNPZMneJXxdvT+qoqhKV8787NYuHnOauhSVyw@mail.gmail.com> (raw)

There's 52d1aa8b8249 in v6.1-rc7:

* netfilter: conntrack: Fix data-races around ct mark

It triggers an error:

#19 355.8 /build/linux-source/net/netfilter/nf_conntrack_netlink.c: In
function '__ctnetlink_glue_build':
#19 355.8 /build/linux-source/net/netfilter/nf_conntrack_netlink.c:2674:13:
error: unused variable 'mark' [-Werror=unused-variable]
#19 355.8  2674 |         u32 mark;
#19 355.8       |             ^~~~
#19 355.8 cc1: all warnings being treated as errors

If CONFIG_NF_CONNTRACK_MARK is not enabled, as mark is declared
unconditionally, but used under ifdef:

 #ifdef CONFIG_NF_CONNTRACK_MARK
-       if ((events & (1 << IPCT_MARK) || ct->mark)
-           && ctnetlink_dump_mark(skb, ct) < 0)
+       mark = READ_ONCE(ct->mark);
+       if ((events & (1 << IPCT_MARK) || mark) &&
+           ctnetlink_dump_mark(skb, mark) < 0)
                goto nla_put_failure;
 #endif

To have NF_CONNTRACK_MARK one needs NETFILTER_ADVANCED:

config NF_CONNTRACK_MARK
        bool  'Connection mark tracking support'
        depends on NETFILTER_ADVANCED

It's supposed to be enabled by default:

config NETFILTER_ADVANCED
        bool "Advanced netfilter configuration"
        depends on NETFILTER
        default y

But it's not in defconfig (it's missing from arm64 completely):

$ rg NETFILTER_ADVANCED arch/x86/configs/x86_64_defconfig
93:# CONFIG_NETFILTER_ADVANCED is not set

I think the solution is to enclose mark definition into ifdef as well
and I'm happy to send a patch if you agree and would like me to.

             reply	other threads:[~2022-11-28  1:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-28  1:30 Ivan Babrou [this message]
2022-11-28 10:00 ` Unused variable 'mark' in v6.1-rc7 Pablo Neira Ayuso
2022-11-28 16:57   ` Ivan Babrou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGjnhw_2oSWfMjNPZMneJXxdvT+qoqhKV8787NYuHnOauhSVyw@mail.gmail.com \
    --to=ivan@ivan.computer \
    --cc=dxu@dxuuu.xyz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).