The following commit has been merged in the master branch: commit e94c183faef42e5ffe85c157ede008f2817bdefd Author: Cheyenne Wills <cwi...@sinenomine.net> Date: Tue Feb 25 20:09:12 2025 -0700
afs: Init structures via designated initializers When the Linux kernel is configured with CONFIG_RANDSTRUCT=y, the following error occurs when building the openafs kernel module: src/libafs/MODLOAD-6.12.0-SP/rand-timer-kernel.c:46:5: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init] 46 | timer_seed, | ^~~~~~~~~~ When the Linux kernel is configured with CONFIG_RANDSTRUCT=y, the Linux build uses a Linux kernel-specific GCC plugin (scripts/gcc-plugins/randomize_layout_plugin.c) that analyzes structures and will add the designated_init attribute to any structure that is determined to be a "pure operations struct" (i.e. contains only function pointers or nested pure ops structs/unions). This is done so the plugin can then randomize the layout. This causes some of our structures to be flagged with the designated_init attribute, which triggers -Werror=designated-init when we don't use designated initializers. Within the Linux specific directory, src/afs/LINUX, the code already uses designated initializers, however some of the shared code within src/afs or that is included in the build for the kernel module still use positional initialization when initializing pure operations structures. Update the shared code that is used when building the Linux kernel module to use designated initializers via the AFS_STRUCT_INIT macro. Use a consistent alignment, and add trailing comma on the last element, change 0 to NULL where applicable. There are no functional changes within this commit. Note: For consistency, all the initializers for rx_securityOps are being updated even though not all of the files are part of the Linux kernel module (e.g. rxkad_server.c). Note: This error was discovered by an automated process that is used by the Gentoo organization to test building packages with a hardened Linux kernel. Change-Id: Ie0b2c86d1bf802f883e0ced4a832e07d2e6729bd Reviewed-on: https://gerrit.openafs.org/16290 Reviewed-by: Michael Meffie <mmef...@sinenomine.net> Reviewed-by: Cheyenne Wills <cwi...@sinenomine.net> Reviewed-by: Andrew Deason <adea...@sinenomine.net> Tested-by: Andrew Deason <adea...@sinenomine.net> src/afs/afs_fetchstore.c | 20 ++++++++++---------- src/crypto/hcrypto/kernel/rand-timer.c | 14 +++++++------- src/rxgk/rxgk_client.c | 30 +++++++++++++++--------------- src/rxgk/rxgk_server.c | 30 +++++++++++++++--------------- src/rxkad/rxkad_client.c | 30 +++++++++++++++--------------- src/rxkad/rxkad_server.c | 30 +++++++++++++++--------------- 6 files changed, 77 insertions(+), 77 deletions(-) -- OpenAFS Master Repository _______________________________________________ OpenAFS-cvs mailing list OpenAFS-cvs@openafs.org https://lists.openafs.org/mailman/listinfo/openafs-cvs