Re: [PATCH 2/4] aio: Remove the now superfluous sentinel elements from ctl_table array

Joel Granados <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.file-systems.cachefs.general,gmane.linux.file-systems,gmane.linux.kernel.aio.general,gmane.linux.kernel.mm,gmane.linux.nfs,gmane.linux.file-systems.ntfs.devel,gmane.comp.file-systems.coda.general
Message-ID <20231109211212.4qkpi3crc77qjls2@localhost>
On Thu, Nov 09, 2023 at 08:08:31AM -0800, Eric Biggers wrote:
> On Thu, Nov 09, 2023 at 05:00:40PM +0100, Joel Granados wrote:
> > > >  static void __init fsverity_init_sysctl(void)
> > > >  {
> > > > +#ifdef CONFIG_FS_VERITY_BUILTIN_SIGNATURES
> > > >  	fsverity_sysctl_header = register_sysctl("fs/verity",
> > > >  						 fsverity_sysctl_table);
> > > > +#else
> > > > +	fsverity_sysctl_header = register_sysctl_sz("fs/verity",
> > > > +						 fsverity_sysctl_table, 0);
> > > > +#endif
> > > >  	if (!fsverity_sysctl_header)
> > > >  		panic("fsverity sysctl registration failed");
> > > 
> > > This does not make sense, and it causes a build error when CONFIG_FS_VERITY=y
> > > and CONFIG_FS_VERITY_BUILTIN_SIGNATURES=n.
> > > 
> > > I think all you need to do is delete the sentinel element, the same as
> > > everywhere else.  I just tested it, and it works fine.
> > I found the reason why I added the CONFIG_FS_VERITY_BUILTIN_SIGNATURES
> > here: it is related to
> > https://lore.kernel.org/all/[email protected]/
> > where the directory is registered with an element only if
> > CONFIG_FS_VERITY_BUILTIN_SIGNATURES is defined. I had forgotten, but I
> > even asked for a clarification on the patch :).
> > 
> > I see that that patch made it to v6.6. So the solution is not to remove
> > the CONFIG_FS_VERITY_BUILTIN_SIGNATURES, but for me to rebase on top of
> > a more up to date base.
> > 
> > @Eric: Please get back to me if the patch in
> > https://lore.kernel.org/all/[email protected]/
> > is no longer relevant.
> > 
> > Best.
> 
> Yes, that patch was merged in 6.6.  I don't think it really matters here though,
> other than the fact that it moved the code to a different file.  I believe all
> you need to do is remove the sentinel element, the same as anywhere else:
Indeed. I thought that I had to handle empty array in a special way, but
it seems that ARRAY_SIZE works for empty arrays as well. I'll correct
this as well. Thx again for the feedback.

Best
> 
> diff --git a/fs/verity/init.c b/fs/verity/init.c
> index a29f062f6047b..b64a76b9ac362 100644
> --- a/fs/verity/init.c
> +++ b/fs/verity/init.c
> @@ -24,7 +24,6 @@ static struct ctl_table fsverity_sysctl_table[] = {
>  		.extra2         = SYSCTL_ONE,
>  	},
>  #endif
> -	{ }
>  };
>  
>  static void __init fsverity_init_sysctl(void)

-- 

Joel Granados
signature.asc (application/pgp-signature, 659 B)
-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmVNSyoACgkQupfNUreW
QU8f6Av9HchdVg/mEHIuP40DNIA/nNONzTP07M8jNvcnTldnVSuWwI+4Jz1T86bF
lIGqKW02Wu62D2pk8vbrld2Yfts/CtbF8JbOGbo9jZtW5/pp9ME3nP7ULVYCtKAl
0Orir/BJ0YB5S499YvRSCzJZFbGKNHK+6+2JO4ZkyxDsWkm0ssEPnxjS5cfgT9H2
DVYPgzrlkxjN5Aq+ZeC4S+/zy6dloY1DphgjaLaQ79X51GmIOlXgsDeuYFXe5M7h
p5cWlztiXyM8YluR3kziAsOHu7ZbdzhON6suvgu3kgjH85MaySub9yv9yHlJkq2p
JjCuPoVdimT4sc/jwQ5V5JtU2UyDAkHackubuZWmD4YU5ypQqozPGG0HDJnKkjw1
I9msvwOiAShUVxtnmSMx4ok2XRLYVZE8kk6tITArY3Rk2smqaWgoeEzloZUI4GEZ
QBj2uZPWnVdm60FyN0JL+m+MVyGnva9IX0GJ6azSnZAi0bNE3qVinsp2J226Hib4
PgBFablU
=eq5q
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.