Skip to contentSkip to conversation

lsm: make keys for static branch static

PATCH Applied Ben Dooks 2 participants 2 messages Jan 6 – Jan 7 Security (LSM)

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 lsm: make keys for static branch static

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?
...

---
 security/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/security.c +1 -1
index 31a688650601..67af9228c4e9 100644
@@ -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__)
Signature · 1 line
2.37.2.352.g3c44437643
maintainer Applied
#1 lore raw
Quoted 12 lines · On Jan 6, 2026 Ben Dooks <[email protected]> wrote:

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?
...

Quoted 4 lines
---
 security/security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Merged into lsm/dev, thanks.

--
paul-moore.com