diff mbox series

sysctl: fix unused function warning

Message ID 20200505140734.503701-1-arnd@arndb.de (mailing list archive)
State New, archived
Headers show
Series sysctl: fix unused function warning | expand

Commit Message

Arnd Bergmann May 5, 2020, 2:07 p.m. UTC
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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 kernel/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin KaFai Lau May 5, 2020, 6:09 p.m. UTC | #1
On Tue, May 05, 2020 at 04:07:12PM +0200, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Luis Chamberlain May 5, 2020, 6:13 p.m. UTC | #2
On Tue, May 05, 2020 at 04:07:12PM +0200, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis
Song Liu May 5, 2020, 6:24 p.m. UTC | #3
> On May 5, 2020, at 7:07 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Song Liu <songliubraving@fb.com>

Thanks for the fix!
Alexei Starovoitov May 5, 2020, 7:01 p.m. UTC | #4
On Tue, May 5, 2020 at 11:25 AM Song Liu <songliubraving@fb.com> wrote:
>
>
>
> > On May 5, 2020, at 7:07 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > 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")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Acked-by: Song Liu <songliubraving@fb.com>
>
> Thanks for the fix!

Applied to bpf-next.

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

Thanks
diff mbox series

Patch

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 86ed5dd29a61..3b0cecf57e79 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -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)