Linux Security Modules development
 help / color / mirror / Atom feed
* [PATCH] lsm: make keys for static branch static
@ 2026-01-06 17:13 Ben Dooks
  2026-01-07  1:57 ` Paul Moore
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2026-01-06 17:13 UTC (permalink / raw)
  To: linux-kernel, linux-security-module; +Cc: serge, jmorris, paul, Ben Dooks

The key use for static-branches are not refrenced by name outside
of the security/security.c file, so make them static. This stops
the sparse warnings about "Should it be static?" such as:

security/security.c: note: in included file:
./include/linux/lsm_hook_defs.h:29:1: warning: symbol 'security_hook_active_binder_set_context_mgr_0' was not declared. Should it be static?
./include/linux/lsm_hook_defs.h:29:1: warning: symbol 'security_hook_active_binder_set_context_mgr_1' was not declared. Should it be static?
./include/linux/lsm_hook_defs.h:29:1: warning: symbol 'security_hook_active_binder_set_context_mgr_2' was not declared. Should it be static?
./include/linux/lsm_hook_defs.h:30:1: warning: symbol 'security_hook_active_binder_transaction_0' was not declared. Should it be static?
...

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 security/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/security.c b/security/security.c
index 31a688650601..67af9228c4e9 100644
--- a/security/security.c
+++ b/security/security.c
@@ -115,7 +115,7 @@ do {						\
 #define DEFINE_LSM_STATIC_CALL(NUM, NAME, RET, ...)			\
 	DEFINE_STATIC_CALL_NULL(LSM_STATIC_CALL(NAME, NUM),		\
 				*((RET(*)(__VA_ARGS__))NULL));		\
-	DEFINE_STATIC_KEY_FALSE(SECURITY_HOOK_ACTIVE_KEY(NAME, NUM));
+	static DEFINE_STATIC_KEY_FALSE(SECURITY_HOOK_ACTIVE_KEY(NAME, NUM));
 
 #define LSM_HOOK(RET, DEFAULT, NAME, ...)				\
 	LSM_DEFINE_UNROLL(DEFINE_LSM_STATIC_CALL, NAME, RET, __VA_ARGS__)
-- 
2.37.2.352.g3c44437643


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-07  1:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 17:13 [PATCH] lsm: make keys for static branch static Ben Dooks
2026-01-07  1:57 ` Paul Moore

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox