Thread (12 messages) 12 messages, 4 authors, 2023-06-23

Re: [PATCH 08/11] sysctl: Add size to register_sysctl_init

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2023-06-21 10:50:09
Also in: bpf, kexec, keyrings, linux-fsdevel, linux-mm, linux-security-module, lkml, xen-devel

On Wed, Jun 21, 2023 at 11:09:57AM +0200, Joel Granados wrote:
 static int __init random_sysctls_init(void)
 {
-	register_sysctl_init("kernel/random", random_table);
+	register_sysctl_init("kernel/random", random_table,
+			     ARRAY_SIZE(random_table));
As mentioned before, why not just do:

#define register_sysctl_init(string, table)	\
	__register_sysctl_init(string, table, ARRAY_SIZE(table);

or something like that?

That way no callers need to change AND you prevent the size from ever
being incorrect?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help