Skip to content

Commit e3a4182

Browse files
WangYuliummakynes
authored andcommitted
netfilter: nf_tables: Only use nf_skip_indirect_calls() when MITIGATION_RETPOLINE
1. MITIGATION_RETPOLINE is x86-only (defined in arch/x86/Kconfig), so no need to AND with CONFIG_X86 when checking if enabled. 2. Remove unused declaration of nf_skip_indirect_calls() when MITIGATION_RETPOLINE is disabled to avoid warnings. 3. Declare nf_skip_indirect_calls() and nf_skip_indirect_calls_enable() as inline when MITIGATION_RETPOLINE is enabled, as they are called only once and have simple logic. Fix follow error with clang-21 when W=1e: net/netfilter/nf_tables_core.c:39:20: error: unused function 'nf_skip_indirect_calls' [-Werror,-Wunused-function] 39 | static inline bool nf_skip_indirect_calls(void) { return false; } | ^~~~~~~~~~~~~~~~~~~~~~ 1 error generated. make[4]: *** [scripts/Makefile.build:207: net/netfilter/nf_tables_core.o] Error 1 make[3]: *** [scripts/Makefile.build:465: net/netfilter] Error 2 make[3]: *** Waiting for unfinished jobs.... Fixes: d8d7606 ("netfilter: nf_tables: add static key to skip retpoline workarounds") Co-developed-by: Wentao Guan <[email protected]> Signed-off-by: Wentao Guan <[email protected]> Signed-off-by: WangYuli <[email protected]> Acked-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 932b32f commit e3a4182

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

net/netfilter/nf_tables_core.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,22 @@
2121
#include <net/netfilter/nf_log.h>
2222
#include <net/netfilter/nft_meta.h>
2323

24-
#if defined(CONFIG_MITIGATION_RETPOLINE) && defined(CONFIG_X86)
25-
24+
#ifdef CONFIG_MITIGATION_RETPOLINE
2625
static struct static_key_false nf_tables_skip_direct_calls;
2726

28-
static bool nf_skip_indirect_calls(void)
27+
static inline bool nf_skip_indirect_calls(void)
2928
{
3029
return static_branch_likely(&nf_tables_skip_direct_calls);
3130
}
3231

33-
static void __init nf_skip_indirect_calls_enable(void)
32+
static inline void __init nf_skip_indirect_calls_enable(void)
3433
{
3534
if (!cpu_feature_enabled(X86_FEATURE_RETPOLINE))
3635
static_branch_enable(&nf_tables_skip_direct_calls);
3736
}
3837
#else
39-
static inline bool nf_skip_indirect_calls(void) { return false; }
40-
4138
static inline void nf_skip_indirect_calls_enable(void) { }
42-
#endif
39+
#endif /* CONFIG_MITIGATION_RETPOLINE */
4340

4441
static noinline void __nft_trace_packet(const struct nft_pktinfo *pkt,
4542
const struct nft_verdict *verdict,

0 commit comments

Comments
 (0)