Re: [PATCH v4 3/3] kexec: Introduce sysctl parameters kexec_load_limit_*

From: Steven Rostedt
Date: Wed Dec 21 2022 - 09:14:47 EST


On Wed, 21 Dec 2022 13:50:03 +0100
Ricardo Ribalda <ribalda@xxxxxxxxxxxx> wrote:

> @@ -941,6 +995,20 @@ static struct ctl_table kexec_core_sysctls[] = {
> .extra1 = SYSCTL_ONE,
> .extra2 = SYSCTL_ONE,
> },
> + {
> + .procname = "kexec_load_limit_panic",
> + .data = &load_limit_panic,
> + .maxlen = sizeof(load_limit_panic),

If I understand the sysctl logic correctly, the .maxlen is the maxlen of
the input to the sysctl, and not the data. Usually set to sizeof(data)
because most proc_handlers write to data directly.

In this case, I believe it's not even used (you override it with the
struct ctl_table tmp). I guess it doesn't really matter what it's set to.
Perhaps just set it to zero and leave it out?

> + .mode = 0644,
> + .proc_handler = kexec_limit_handler,
> + },
> + {
> + .procname = "kexec_load_limit_reboot",
> + .data = &load_limit_reboot,
> + .maxlen = sizeof(load_limit_reboot),

Same here.

-- Steve

> + .mode = 0644,
> + .proc_handler = kexec_limit_handler,
> + },
> { }
> };
>