]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selinux: declare read-only data arrays const
authorChristian Göttsche <cgzones@googlemail.com>
Thu, 20 Apr 2023 15:05:03 +0000 (17:05 +0200)
committerPaul Moore <paul@paul-moore.com>
Mon, 8 May 2023 20:52:05 +0000 (16:52 -0400)
The array of mount tokens in only used in match_opt_prefix() and never
modified.

The array of symtab names is never modified and only used in the
DEBUG_HASHES configuration as output.

The array of files for the SElinux filesystem sub-directory `ss` is
similar to the other `struct tree_descr` usages only read from to
construct the containing entries.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/hooks.c
security/selinux/selinuxfs.c
security/selinux/ss/policydb.c

index c49ce2044a179b205020c1c0157dc0d12f5fe970..99ded60a6b911161c6adc22cd01d95622b6b85ec 100644 (file)
@@ -357,7 +357,7 @@ enum {
 };
 
 #define A(s, has_arg) {#s, sizeof(#s) - 1, Opt_##s, has_arg}
-static struct {
+static const struct {
        const char *name;
        int len;
        int opt;
index 7cc7e2f0272b69e20888734135d6328a99de7884..bad1f6b685fd9a62c10157b1d8def363c6432841 100644 (file)
@@ -1649,7 +1649,7 @@ static int sel_make_ss_files(struct dentry *dir)
        struct super_block *sb = dir->d_sb;
        struct selinux_fs_info *fsi = sb->s_fs_info;
        int i;
-       static struct tree_descr files[] = {
+       static const struct tree_descr files[] = {
                { "sidtab_hash_stats", &sel_sidtab_hash_stats_ops, S_IRUGO },
        };
 
index adcfb63b3550db98d0151c78fbd99588437125c3..97c0074f9312ad16b19fa9151859c4f9c03a60fa 100644 (file)
@@ -42,7 +42,7 @@
 #include "services.h"
 
 #ifdef DEBUG_HASHES
-static const char *symtab_name[SYM_NUM] = {
+static const char *const symtab_name[SYM_NUM] = {
        "common prefixes",
        "classes",
        "roles",