[v3,2/3] ipc: remove linebreaks from arguments of __register_sysctl_table

Message ID 20240219-sysctl-check-v3-2-6940d5ff747b@weissschuh.net
State New
Headers
Series scripts: check-sysctl-docs: adapt to new API |

Commit Message

Thomas Weißschuh Feb. 19, 2024, 8:19 p.m. UTC
  Calls to __register_sysctl_table will be validated by
scripts/check-sysctl-docs. As this script is line-based remove the
linebreak which would confuse the script.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 ipc/ipc_sysctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Joel Granados Feb. 23, 2024, 9:59 a.m. UTC | #1
On Mon, Feb 19, 2024 at 09:19:23PM +0100, Thomas Weißschuh wrote:
> Calls to __register_sysctl_table will be validated by
> scripts/check-sysctl-docs. As this script is line-based remove the
> linebreak which would confuse the script.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  ipc/ipc_sysctl.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
> index 8c62e443f78b..e4008288a3ba 100644
> --- a/ipc/ipc_sysctl.c
> +++ b/ipc/ipc_sysctl.c
> @@ -259,8 +259,7 @@ bool setup_ipc_sysctls(struct ipc_namespace *ns)
>  				tbl[i].data = NULL;
>  		}
>  
> -		ns->ipc_sysctls = __register_sysctl_table(&ns->ipc_set,
> -							  "kernel", tbl,
> +		ns->ipc_sysctls = __register_sysctl_table(&ns->ipc_set, "kernel", tbl,
>  							  ARRAY_SIZE(ipc_sysctls));
>  	}
>  	if (!ns->ipc_sysctls) {
This is very interesting and points to a bigger issue with the
check-sysctl-docs: which is that the AWK record separator is "\n" and it
require that the lines being analyzed follow a strict pattern; even if
that meant having a loooong line (not the case in this patch).

The final solution would be to change the separator to something less
line based to something more C based like RS=";{}". This is not a
blocker to this patchset as it actually fixes a broken script. But is an
interesting observation for whomever wants to continue this work.

Thx Thomas.

Best
  

Patch

diff --git a/ipc/ipc_sysctl.c b/ipc/ipc_sysctl.c
index 8c62e443f78b..e4008288a3ba 100644
--- a/ipc/ipc_sysctl.c
+++ b/ipc/ipc_sysctl.c
@@ -259,8 +259,7 @@  bool setup_ipc_sysctls(struct ipc_namespace *ns)
 				tbl[i].data = NULL;
 		}
 
-		ns->ipc_sysctls = __register_sysctl_table(&ns->ipc_set,
-							  "kernel", tbl,
+		ns->ipc_sysctls = __register_sysctl_table(&ns->ipc_set, "kernel", tbl,
 							  ARRAY_SIZE(ipc_sysctls));
 	}
 	if (!ns->ipc_sysctls) {