Skip to contentSkip to conversation

sysctl: fix unused function warning

PATCH Applied Arnd Bergmann 5 participants 5 messages May 5, 2020

Subsystems (5)
Networking Network drivers VFS BPF +1 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysctl: fix unused function warning

The newly added bpf_stats_handler function has the wrong #ifdef check around it, leading to an unused-function warning when CONFIG_SYSCTL is disabled:

kernel/sysctl.c:205:12: error: unused function 'bpf_stats_handler' [-Werror,-Wunused-function] static int bpf_stats_handler(struct ctl_table *table, int write,

Fix the check to match the reference.

Fixes d46edd671a14 ("bpf: Sharing bpf runtime stats with BPF_ENABLE_STATS")
---
 kernel/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sysctl.c +1 -1
index 86ed5dd29a61..3b0cecf57e79 100644
@@ -201,7 +201,7 @@ static int max_extfrag_threshold = 1000;
 
 #endif /* CONFIG_SYSCTL */
 
-#ifdef CONFIG_BPF_SYSCALL
+#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
 static int bpf_stats_handler(struct ctl_table *table, int write,
 			     void __user *buffer, size_t *lenp,
 			     loff_t *ppos)
Signature · 1 line
2.26.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

The newly added bpf_stats_handler function has the wrong #ifdef check around it, leading to an unused-function warning when CONFIG_SYSCTL is disabled:

kernel/sysctl.c:205:12: error: unused function 'bpf_stats_handler' [-Werror,-Wunused-function] static int bpf_stats_handler(struct ctl_table *table, int write,

Fix the check to match the reference.

Fixes d46edd671a14 ("bpf: Sharing bpf runtime stats with BPF_ENABLE_STATS")
Reviewed-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

The newly added bpf_stats_handler function has the wrong #ifdef check around it, leading to an unused-function warning when CONFIG_SYSCTL is disabled:

kernel/sysctl.c:205:12: error: unused function 'bpf_stats_handler' [-Werror,-Wunused-function] static int bpf_stats_handler(struct ctl_table *table, int write,

Fix the check to match the reference.

Fixes d46edd671a14 ("bpf: Sharing bpf runtime stats with BPF_ENABLE_STATS")

Luis

Acked-by on v1 1/1
#3 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

The newly added bpf_stats_handler function has the wrong #ifdef check around it, leading to an unused-function warning when CONFIG_SYSCTL is disabled:

Quoted 7 lines

kernel/sysctl.c:205:12: error: unused function 'bpf_stats_handler' [-Werror,-Wunused-function] static int bpf_stats_handler(struct ctl_table *table, int write,

Fix the check to match the reference.

Fixes d46edd671a14 ("bpf: Sharing bpf runtime stats with BPF_ENABLE_STATS")

Thanks for the fix!

#4 lore raw
Quoted 12 lines · Song Liu
Quoted 12 lines · Arnd Bergmann

The newly added bpf_stats_handler function has the wrong #ifdef check around it, leading to an unused-function warning when CONFIG_SYSCTL is disabled:

kernel/sysctl.c:205:12: error: unused function 'bpf_stats_handler' [-Werror,-Wunused-function] static int bpf_stats_handler(struct ctl_table *table, int write,

Quoted 8 lines
Quoted 4 lines

Fix the check to match the reference.

Fixes d46edd671a14 ("bpf: Sharing bpf runtime stats with BPF_ENABLE_STATS")

Thanks for the fix!

Applied to bpf-next.

Arnd, please make sure subject includes target tree like [PATCH bpf-next] in the future.

Thanks