]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lsm: make keys for static branch static
authorBen Dooks <ben.dooks@codethink.co.uk>
Tue, 6 Jan 2026 17:13:32 +0000 (17:13 +0000)
committerPaul Moore <paul@paul-moore.com>
Wed, 7 Jan 2026 01:57:55 +0000 (20:57 -0500)
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?
...

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
[PM: trimmed sparse output for line-length, readability]
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/security.c

index 31a688650601b62df1e536bbe4407817edbd6707..67af9228c4e9413d62aff17884657427adfaa4b0 100644 (file)
@@ -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__)