2019-03-04 20:37:17

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH] bpf: fix sysctl.c warning

When CONFIG_BPF_SYSCALL or CONFIG_SYSCTL is disabled, we get
a warning about an unused function:

kernel/sysctl.c:3331:12: error: 'proc_dointvec_minmax_bpf_stats' defined but not used [-Werror=unused-function]
static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,

The CONFIG_BPF_SYSCALL check was already handled, but the SYSCTL check
is needed on top.

Fixes: 492ecee892c2 ("bpf: enable program stats")
Signed-off-by: Arnd Bergmann <[email protected]>
---
kernel/sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 46a0d0a14a66..b3df3ab7ac28 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -3330,7 +3330,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,

#endif /* CONFIG_PROC_SYSCTL */

-#ifdef CONFIG_BPF_SYSCALL
+#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
--
2.20.0



2019-03-04 20:48:43

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH] bpf: fix sysctl.c warning

On Mon, Mar 4, 2019 at 12:34 PM Arnd Bergmann <[email protected]> wrote:
>
> When CONFIG_BPF_SYSCALL or CONFIG_SYSCTL is disabled, we get
> a warning about an unused function:
>
> kernel/sysctl.c:3331:12: error: 'proc_dointvec_minmax_bpf_stats' defined but not used [-Werror=unused-function]
> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
>
> The CONFIG_BPF_SYSCALL check was already handled, but the SYSCTL check
> is needed on top.
>
> Fixes: 492ecee892c2 ("bpf: enable program stats")
> Signed-off-by: Arnd Bergmann <[email protected]>

Reviewed-by: Kees Cook <[email protected]>

-Kees

> ---
> kernel/sysctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 46a0d0a14a66..b3df3ab7ac28 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -3330,7 +3330,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
>
> #endif /* CONFIG_PROC_SYSCTL */
>
> -#ifdef CONFIG_BPF_SYSCALL
> +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
> void __user *buffer, size_t *lenp,
> loff_t *ppos)
> --
> 2.20.0
>


--
Kees Cook

2019-03-04 20:57:55

by Christian Brauner

[permalink] [raw]
Subject: Re: [PATCH] bpf: fix sysctl.c warning

On Mon, Mar 04, 2019 at 09:34:12PM +0100, Arnd Bergmann wrote:
> When CONFIG_BPF_SYSCALL or CONFIG_SYSCTL is disabled, we get
> a warning about an unused function:
>
> kernel/sysctl.c:3331:12: error: 'proc_dointvec_minmax_bpf_stats' defined but not used [-Werror=unused-function]
> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
>
> The CONFIG_BPF_SYSCALL check was already handled, but the SYSCTL check
> is needed on top.
>
> Fixes: 492ecee892c2 ("bpf: enable program stats")
> Signed-off-by: Arnd Bergmann <[email protected]>

Reviewed-by: Christian Brauner <[email protected]>

> ---
> kernel/sysctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 46a0d0a14a66..b3df3ab7ac28 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -3330,7 +3330,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
>
> #endif /* CONFIG_PROC_SYSCTL */
>
> -#ifdef CONFIG_BPF_SYSCALL
> +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
> void __user *buffer, size_t *lenp,
> loff_t *ppos)
> --
> 2.20.0
>

2019-03-04 21:00:30

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH] bpf: fix sysctl.c warning



> On Mar 4, 2019, at 12:57 PM, Christian Brauner <[email protected]> wrote:
>
> On Mon, Mar 04, 2019 at 09:34:12PM +0100, Arnd Bergmann wrote:
>> When CONFIG_BPF_SYSCALL or CONFIG_SYSCTL is disabled, we get
>> a warning about an unused function:
>>
>> kernel/sysctl.c:3331:12: error: 'proc_dointvec_minmax_bpf_stats' defined but not used [-Werror=unused-function]
>> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
>>
>> The CONFIG_BPF_SYSCALL check was already handled, but the SYSCTL check
>> is needed on top.
>>
>> Fixes: 492ecee892c2 ("bpf: enable program stats")
>> Signed-off-by: Arnd Bergmann <[email protected]>
>
> Reviewed-by: Christian Brauner <[email protected]>

Acked-by: Song Liu <[email protected]>

>
>> ---
>> kernel/sysctl.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
>> index 46a0d0a14a66..b3df3ab7ac28 100644
>> --- a/kernel/sysctl.c
>> +++ b/kernel/sysctl.c
>> @@ -3330,7 +3330,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
>>
>> #endif /* CONFIG_PROC_SYSCTL */
>>
>> -#ifdef CONFIG_BPF_SYSCALL
>> +#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL)
>> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
>> void __user *buffer, size_t *lenp,
>> loff_t *ppos)
>> --
>> 2.20.0
>>


2019-03-07 10:05:59

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH] bpf: fix sysctl.c warning

On 03/04/2019 09:34 PM, Arnd Bergmann wrote:
> When CONFIG_BPF_SYSCALL or CONFIG_SYSCTL is disabled, we get
> a warning about an unused function:
>
> kernel/sysctl.c:3331:12: error: 'proc_dointvec_minmax_bpf_stats' defined but not used [-Werror=unused-function]
> static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write,
>
> The CONFIG_BPF_SYSCALL check was already handled, but the SYSCTL check
> is needed on top.
>
> Fixes: 492ecee892c2 ("bpf: enable program stats")
> Signed-off-by: Arnd Bergmann <[email protected]>

Applied, thanks!