Re: [PATCH net v1 1/1] netfilter: conntrack: Guard possoble unused functions

From: Andy Shevchenko
Date: Mon Sep 09 2024 - 05:27:09 EST


On Fri, Sep 06, 2024 at 05:29:38PM +0100, Simon Horman wrote:
> On Thu, Sep 05, 2024 at 11:36:12PM +0300, Andy Shevchenko wrote:
> > Some of the functions may be unused, it prevents kernel builds
> > with clang, `make W=1` and CONFIG_WERROR=y:
> >
> > net/netfilter/nf_conntrack_netlink.c:657:22: error: unused function 'ctnetlink_acct_size' [-Werror,-Wunused-function]
> > 657 | static inline size_t ctnetlink_acct_size(const struct nf_conn *ct)
> > | ^~~~~~~~~~~~~~~~~~~
> > net/netfilter/nf_conntrack_netlink.c:667:19: error: unused function 'ctnetlink_secctx_size' [-Werror,-Wunused-function]
> > 667 | static inline int ctnetlink_secctx_size(const struct nf_conn *ct)
> > | ^~~~~~~~~~~~~~~~~~~~~
> > net/netfilter/nf_conntrack_netlink.c:683:22: error: unused function 'ctnetlink_timestamp_size' [-Werror,-Wunused-function]
> > 683 | static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct)
> > | ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Hi Andy,
>
> Local testing seems to show that the warning is still emitted
> for ctnetlink_label_size if CONFIG_NETFILTER_NETLINK_GLUE_CT is enabled
> but CONFIG_NF_CONNTRACK_EVENTS is not.

Hmm... Let me try that. I am using mostly x86_64_defconfig for the testing.
The idea is to have once x86_64_defconfig to be clean with W=1 and since then
it will be easier to enable it unconditionally for CIs for _that_ particular
configuration(s) ("s" in case of i386_defconfig to be at the same level).

> > Fix this by guarding possible unused functions with ifdeffery.
> >
> > See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static
> > inline functions for W=1 build").
> >
> > Fixes: 4a96300cec88 ("netfilter: ctnetlink: restore inlining for netlink message size calculation")
>
> I'm not sure that this qualifies as a fix, rather I think it should
> be targeted at net-next without a Fixes tag.

Okay.

Thank you for the review!

--
With Best Regards,
Andy Shevchenko