Re: [PATCH v2] sysctl: simplify the min/max boundary check

From: Joel Granados
Date: Wed Jul 31 2024 - 03:19:34 EST


On Mon, Jul 15, 2024 at 11:02:23PM +0800, Wen Yang wrote:
> The do_proc_dointvec_minmax_conv_param structure provides the minimum and
> maximum values for doing range checking for the proc_dointvec_minmax()
> handler, while the do_proc_douintvec_minmax_conv_param structure also
> provides the minimum and maximum values for doing range checking for the
> proc_douintvec_minmax()/proc_dou8vec_minmax() handlers.
>
> To avoid duplicate code, a new do_proc_minmax_conv_param structure has been
> introduced to replace both do_proc_dointvec_minmax_conv_param and
> do_proc_douintvec_minmax_conv_param mentioned above.
>
> This also prepares for the removal of sysctl_vals and sysctl_long_vals.
>
> Signed-off-by: Wen Yang <wen.yang@xxxxxxxxx>
> Cc: Luis Chamberlain <mcgrof@xxxxxxxxxx>
> Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> Cc: Joel Granados <j.granados@xxxxxxxxxxx>
> Cc: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>
> Cc: Christian Brauner <brauner@xxxxxxxxxx>
> Cc: Dave Young <dyoung@xxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
> kernel/sysctl.c | 107 ++++++++++++++++++++++++++----------------------
This does not cleanly apply to current 6.11-rc1. Please send a v3 that
applies to current release. Thx

Best

--

Joel Granados