aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/selinux/mdp/mdp.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2022-05-02 16:43:38 +0200
committerPaul Moore <paul@paul-moore.com>2022-05-03 15:53:49 -0400
commitded34574d4d351ab0ca095a45496b393cef611c2 (patch)
tree6884a97c4ba2c10ad542db83cfbd8afeab326895 /scripts/selinux/mdp/mdp.c
parentselinux: fix indentation level of mls_ops block (diff)
downloadlinux-dev-ded34574d4d351ab0ca095a45496b393cef611c2.tar.xz
linux-dev-ded34574d4d351ab0ca095a45496b393cef611c2.zip
selinux: declare data arrays const
The arrays for the policy capability names, the initial sid identifiers and the class and permission names are not changed at runtime. Declare them const to avoid accidental modification. Do not override the classmap and the initial sid list in the build time script genheaders. Check flose(3) is successful in genheaders.c, otherwise the written data might be corrupted or incomplete. Signed-off-by: Christian Göttsche <cgzones@googlemail.com> [PM: manual merge due to fuzz, minor style tweaks] Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to '')
-rw-r--r--scripts/selinux/mdp/mdp.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c
index 105c1c31a316..1415604c3d24 100644
--- a/scripts/selinux/mdp/mdp.c
+++ b/scripts/selinux/mdp/mdp.c
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
/* print out the class permissions */
for (i = 0; secclass_map[i].name; i++) {
- struct security_class_mapping *map = &secclass_map[i];
+ const struct security_class_mapping *map = &secclass_map[i];
fprintf(fout, "class %s\n", map->name);
fprintf(fout, "{\n");
for (j = 0; map->perms[j]; j++)
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
#define SYSTEMLOW "s0"
#define SYSTEMHIGH "s1:c0.c1"
for (i = 0; secclass_map[i].name; i++) {
- struct security_class_mapping *map = &secclass_map[i];
+ const struct security_class_mapping *map = &secclass_map[i];
fprintf(fout, "mlsconstrain %s {\n", map->name);
for (j = 0; map->perms[j]; j++)