✗ CI.checkpatch: warning for treewide: const qualify ctl_tables where applicable
Joel Granados
joel.granados at kernel.org
Fri Jan 10 11:40:00 UTC 2025
On Thu, Jan 09, 2025 at 04:11:44PM -0000, Patchwork wrote:
> == Series Details ==
>
> Series: treewide: const qualify ctl_tables where applicable
> URL : https://patchwork.freedesktop.org/series/143333/
> State : warning
This can be ignored.
>
> == Summary ==
>
> + KERNEL=/kernel
> + git clone https://gitlab.freedesktop.org/drm/maintainer-tools mt
> Cloning into 'mt'...
> warning: redirecting to https://gitlab.freedesktop.org/drm/maintainer-tools.git/
> + git -C mt rev-list -n1 origin/master
> 30ab6715fc09baee6cc14cb3c89ad8858688d474
> + cd /kernel
> + git config --global --add safe.directory /kernel
> + git log -n1
> commit 8c9fd692cfd7df82d0454d25ab66dc2185697be7
> Author: Joel Granados <joel.granados at kernel.org>
> Date: Thu Jan 9 14:16:39 2025 +0100
>
> treewide: const qualify ctl_tables where applicable
>
> Add the const qualifier to all the ctl_tables in the tree except the
> ones in ./net dir. The "net" sysctl code is special as it modifies the
> arrays before passing it on to the registration function.
>
> Constifying ctl_table structs will prevent the modification of
> proc_handler function pointers as the arrays would reside in .rodata.
> This is made possible after commit 78eb4ea25cd5 ("sysctl: treewide:
> constify the ctl_table argument of proc_handlers") constified all the
> proc_handlers.
>
> Created this by running an spatch followed by a sed command:
> Spatch:
> virtual patch
>
> @
> depends on !(file in "net")
> disable optional_qualifier
> @
> identifier table_name;
> @@
>
> + const
> struct ctl_table table_name [] = { ... };
>
> sed:
> sed --in-place \
> -e "s/struct ctl_table .table = &uts_kern/const struct ctl_table *table = \&uts_kern/" \
This line is a little bit long, but I think dividing it is overkill
> kernel/utsname_sysctl.c
>
> Signed-off-by: Joel Granados <joel.granados at kernel.org>
> Acked-by: Steven Rostedt (Google) <rostedt at goodmis.org> # for kernel/trace/
> Acked-by: Jani Nikula <jani.nikula at intel.com>
> Reviewed-by: "Darrick J. Wong" <djwong at kernel.org> # xfs
> + /mt/dim checkpatch 424f495e9572bf87a42e3be0aa02ac4777541033 drm-intel
> 8c9fd692cfd7 treewide: const qualify ctl_tables where applicable
> -:32: WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?)
> #32:
> -e "s/struct ctl_table .table = &uts_kern/const struct ctl_table *table = \&uts_kern/" \
>
> -:444: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
> #444: FILE: drivers/misc/sgi-xp/xpc_main.c:114:
> };
> +static const struct ctl_table xpc_sys_xpc[] = {
pre-existing from before
>
> -:1224: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
> #1224: FILE: kernel/stackleak.c:47:
> }
> +static const struct ctl_table stackleak_sysctls[] = {
pre-existing from before
>
> total: 0 errors, 1 warnings, 2 checks, 960 lines checked
>
>
best
--
Joel Granados
More information about the Intel-xe
mailing list