kernel/bpf/syscall.c | 1 - 1 file changed, 1 deletion(-)
Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this
case we have our own proc_handler. Remove the initialization.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
bpf: Trivial remove of unitialised field.
I have inspired myself in your code and heritaded this bug :). Fixing this
here so none else makes the same mistake.
To: Alexei Starovoitov <ast@kernel.org>
To: Daniel Borkmann <daniel@iogearbox.net>
To: John Fastabend <john.fastabend@gmail.com>
To: Andrii Nakryiko <andrii@kernel.org>
To: Martin KaFai Lau <martin.lau@linux.dev>
To: Song Liu <song@kernel.org>
To: Yonghong Song <yhs@fb.com>
To: KP Singh <kpsingh@kernel.org>
To: Stanislav Fomichev <sdf@google.com>
To: Hao Luo <haoluo@google.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
kernel/bpf/syscall.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 35972afb6850..8e55456bd648 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = {
{
.procname = "bpf_stats_enabled",
.data = &bpf_stats_enabled_key.key,
- .maxlen = sizeof(bpf_stats_enabled_key),
.mode = 0644,
.proc_handler = bpf_stats_handler,
},
---
base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
change-id: 20221221-bpf-syscall-58d1ac3f817a
Best regards,
--
Ricardo Ribalda <ribalda@chromium.org>
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:
On Wed, 21 Dec 2022 20:55:29 +0100 you wrote:
> Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this
> case we have our own proc_handler. Remove the initialization.
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> bpf: Trivial remove of unitialised field.
>
> [...]
Here is the summary with links:
- bpf: Remove unused field initialization
https://git.kernel.org/bpf/bpf-next/c/cfca00767feb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
On Wed, Dec 21, 2022 at 11:55 AM Ricardo Ribalda <ribalda@chromium.org> wrote:
>
> Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this
> case we have our own proc_handler. Remove the initialization.
Are you sure?
bpf_stats_handler
proc_dointvec_minmax
do_proc_dointvec
__do_proc_dointvec
vleft = table->maxlen / sizeof(*i);
Maybe we should really do the following instead?
.maxlen: sizeof(int)
?
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> bpf: Trivial remove of unitialised field.
>
> I have inspired myself in your code and heritaded this bug :). Fixing this
> here so none else makes the same mistake.
>
> To: Alexei Starovoitov <ast@kernel.org>
> To: Daniel Borkmann <daniel@iogearbox.net>
> To: John Fastabend <john.fastabend@gmail.com>
> To: Andrii Nakryiko <andrii@kernel.org>
> To: Martin KaFai Lau <martin.lau@linux.dev>
> To: Song Liu <song@kernel.org>
> To: Yonghong Song <yhs@fb.com>
> To: KP Singh <kpsingh@kernel.org>
> To: Stanislav Fomichev <sdf@google.com>
> To: Hao Luo <haoluo@google.com>
> To: Jiri Olsa <jolsa@kernel.org>
> Cc: bpf@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> kernel/bpf/syscall.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 35972afb6850..8e55456bd648 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = {
> {
> .procname = "bpf_stats_enabled",
> .data = &bpf_stats_enabled_key.key,
> - .maxlen = sizeof(bpf_stats_enabled_key),
> .mode = 0644,
> .proc_handler = bpf_stats_handler,
> },
>
> ---
> base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
> change-id: 20221221-bpf-syscall-58d1ac3f817a
>
> Best regards,
> --
> Ricardo Ribalda <ribalda@chromium.org>
Hi Stanislav
On Wed, 21 Dec 2022 at 21:10, Stanislav Fomichev <sdf@google.com> wrote:
>
> On Wed, Dec 21, 2022 at 11:55 AM Ricardo Ribalda <ribalda@chromium.org> wrote:
> >
> > Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this
> > case we have our own proc_handler. Remove the initialization.
>
> Are you sure?
>
> bpf_stats_handler
> proc_dointvec_minmax
> do_proc_dointvec
> __do_proc_dointvec
> vleft = table->maxlen / sizeof(*i);
I believe do_proc_dointvec is using the value from:
struct ctl_table tmp = {
.maxlen=sixeof(val);
}
>
> Maybe we should really do the following instead?
>
> .maxlen: sizeof(int)
>
> ?
>
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > ---
> > bpf: Trivial remove of unitialised field.
> >
> > I have inspired myself in your code and heritaded this bug :). Fixing this
> > here so none else makes the same mistake.
> >
> > To: Alexei Starovoitov <ast@kernel.org>
> > To: Daniel Borkmann <daniel@iogearbox.net>
> > To: John Fastabend <john.fastabend@gmail.com>
> > To: Andrii Nakryiko <andrii@kernel.org>
> > To: Martin KaFai Lau <martin.lau@linux.dev>
> > To: Song Liu <song@kernel.org>
> > To: Yonghong Song <yhs@fb.com>
> > To: KP Singh <kpsingh@kernel.org>
> > To: Stanislav Fomichev <sdf@google.com>
> > To: Hao Luo <haoluo@google.com>
> > To: Jiri Olsa <jolsa@kernel.org>
> > Cc: bpf@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > ---
> > kernel/bpf/syscall.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> > index 35972afb6850..8e55456bd648 100644
> > --- a/kernel/bpf/syscall.c
> > +++ b/kernel/bpf/syscall.c
> > @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = {
> > {
> > .procname = "bpf_stats_enabled",
> > .data = &bpf_stats_enabled_key.key,
> > - .maxlen = sizeof(bpf_stats_enabled_key),
> > .mode = 0644,
> > .proc_handler = bpf_stats_handler,
> > },
> >
> > ---
> > base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
> > change-id: 20221221-bpf-syscall-58d1ac3f817a
> >
> > Best regards,
> > --
> > Ricardo Ribalda <ribalda@chromium.org>
--
Ricardo Ribalda
On Wed, Dec 21, 2022 at 12:13 PM Ricardo Ribalda <ribalda@chromium.org> wrote:
>
> Hi Stanislav
>
> On Wed, 21 Dec 2022 at 21:10, Stanislav Fomichev <sdf@google.com> wrote:
> >
> > On Wed, Dec 21, 2022 at 11:55 AM Ricardo Ribalda <ribalda@chromium.org> wrote:
> > >
> > > Maxlen is used by standard proc_handlers such as proc_dointvec(), but in this
> > > case we have our own proc_handler. Remove the initialization.
> >
> > Are you sure?
> >
> > bpf_stats_handler
> > proc_dointvec_minmax
> > do_proc_dointvec
> > __do_proc_dointvec
> > vleft = table->maxlen / sizeof(*i);
>
> I believe do_proc_dointvec is using the value from:
>
> struct ctl_table tmp = {
> .maxlen=sixeof(val);
> }
Oh, you're right, I've missed that!
Acked-by: Stanislav Fomichev <sdf@google.com>
> >
> > Maybe we should really do the following instead?
> >
> > .maxlen: sizeof(int)
> >
> > ?
> >
> > > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> > > ---
> > > bpf: Trivial remove of unitialised field.
> > >
> > > I have inspired myself in your code and heritaded this bug :). Fixing this
> > > here so none else makes the same mistake.
> > >
> > > To: Alexei Starovoitov <ast@kernel.org>
> > > To: Daniel Borkmann <daniel@iogearbox.net>
> > > To: John Fastabend <john.fastabend@gmail.com>
> > > To: Andrii Nakryiko <andrii@kernel.org>
> > > To: Martin KaFai Lau <martin.lau@linux.dev>
> > > To: Song Liu <song@kernel.org>
> > > To: Yonghong Song <yhs@fb.com>
> > > To: KP Singh <kpsingh@kernel.org>
> > > To: Stanislav Fomichev <sdf@google.com>
> > > To: Hao Luo <haoluo@google.com>
> > > To: Jiri Olsa <jolsa@kernel.org>
> > > Cc: bpf@vger.kernel.org
> > > Cc: linux-kernel@vger.kernel.org
> > > ---
> > > kernel/bpf/syscall.c | 1 -
> > > 1 file changed, 1 deletion(-)
> > >
> > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> > > index 35972afb6850..8e55456bd648 100644
> > > --- a/kernel/bpf/syscall.c
> > > +++ b/kernel/bpf/syscall.c
> > > @@ -5319,7 +5319,6 @@ static struct ctl_table bpf_syscall_table[] = {
> > > {
> > > .procname = "bpf_stats_enabled",
> > > .data = &bpf_stats_enabled_key.key,
> > > - .maxlen = sizeof(bpf_stats_enabled_key),
> > > .mode = 0644,
> > > .proc_handler = bpf_stats_handler,
> > > },
> > >
> > > ---
> > > base-commit: b6bb9676f2165d518b35ba3bea5f1fcfc0d969bf
> > > change-id: 20221221-bpf-syscall-58d1ac3f817a
> > >
> > > Best regards,
> > > --
> > > Ricardo Ribalda <ribalda@chromium.org>
>
>
>
> --
> Ricardo Ribalda
© 2016 - 2026 Red Hat, Inc.