Skip to content

Commit b1a867e

Browse files
committed
lsm: mark the lsm_id variables are marked as static
As the kernel test robot helpfully reminded us, all of the lsm_id instances defined inside the various LSMs should be marked as static. The one exception is Landlock which uses its lsm_id variable across multiple source files with an extern declaration in a header file. Reported-by: kernel test robot <lkp@intel.com> Suggested-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 9ba8802 commit b1a867e

9 files changed

Lines changed: 9 additions & 9 deletions

File tree

security/apparmor/lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ struct lsm_blob_sizes apparmor_blob_sizes __ro_after_init = {
14541454
.lbs_task = sizeof(struct aa_task_ctx),
14551455
};
14561456

1457-
const struct lsm_id apparmor_lsmid = {
1457+
static const struct lsm_id apparmor_lsmid = {
14581458
.name = "apparmor",
14591459
.id = LSM_ID_APPARMOR,
14601460
};

security/bpf/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static struct security_hook_list bpf_lsm_hooks[] __ro_after_init = {
1616
LSM_HOOK_INIT(task_free, bpf_task_storage_free),
1717
};
1818

19-
const struct lsm_id bpf_lsmid = {
19+
static const struct lsm_id bpf_lsmid = {
2020
.name = "bpf",
2121
.id = LSM_ID_BPF,
2222
};

security/commoncap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ int cap_mmap_file(struct file *file, unsigned long reqprot,
14411441

14421442
#ifdef CONFIG_SECURITY
14431443

1444-
const struct lsm_id capability_lsmid = {
1444+
static const struct lsm_id capability_lsmid = {
14451445
.name = "capability",
14461446
.id = LSM_ID_CAPABILITY,
14471447
};

security/loadpin/loadpin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int loadpin_load_data(enum kernel_load_data_id id, bool contents)
209209
return loadpin_check(NULL, (enum kernel_read_file_id) id);
210210
}
211211

212-
const struct lsm_id loadpin_lsmid = {
212+
static const struct lsm_id loadpin_lsmid = {
213213
.name = "loadpin",
214214
.id = LSM_ID_LOADPIN,
215215
};

security/safesetid/lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ static int safesetid_task_fix_setgroups(struct cred *new, const struct cred *old
262262
return 0;
263263
}
264264

265-
const struct lsm_id safesetid_lsmid = {
265+
static const struct lsm_id safesetid_lsmid = {
266266
.name = "safesetid",
267267
.id = LSM_ID_SAFESETID,
268268
};

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7031,7 +7031,7 @@ static int selinux_uring_cmd(struct io_uring_cmd *ioucmd)
70317031
}
70327032
#endif /* CONFIG_IO_URING */
70337033

7034-
const struct lsm_id selinux_lsmid = {
7034+
static const struct lsm_id selinux_lsmid = {
70357035
.name = "selinux",
70367036
.id = LSM_ID_SELINUX,
70377037
};

security/smack/smack_lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5006,7 +5006,7 @@ struct lsm_blob_sizes smack_blob_sizes __ro_after_init = {
50065006
.lbs_xattr_count = SMACK_INODE_INIT_XATTRS,
50075007
};
50085008

5009-
const struct lsm_id smack_lsmid = {
5009+
static const struct lsm_id smack_lsmid = {
50105010
.name = "smack",
50115011
.id = LSM_ID_SMACK,
50125012
};

security/tomoyo/tomoyo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ static void tomoyo_task_free(struct task_struct *task)
543543
}
544544
}
545545

546-
const struct lsm_id tomoyo_lsmid = {
546+
static const struct lsm_id tomoyo_lsmid = {
547547
.name = "tomoyo",
548548
.id = LSM_ID_TOMOYO,
549549
};

security/yama/yama_lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static int yama_ptrace_traceme(struct task_struct *parent)
422422
return rc;
423423
}
424424

425-
const struct lsm_id yama_lsmid = {
425+
static const struct lsm_id yama_lsmid = {
426426
.name = "yama",
427427
.id = LSM_ID_YAMA,
428428
};

0 commit comments

Comments
 (0)