Skip to content

Commit 002903e

Browse files
cgzonespcmoore
authored andcommitted
selinux: update type for number of class permissions in services code
Security classes have only up to 32 permissions, hence using an u16 is sufficient (while improving padding in struct selinux_mapping). Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent df9d474 commit 002903e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

security/selinux/ss/services.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ static int selinux_set_mapping(struct policydb *pol,
9797
struct selinux_map *out_map)
9898
{
9999
u16 i, j;
100-
unsigned k;
101100
bool print_unknown_handle = false;
102101

103102
/* Find number of classes in the input mapping */
@@ -117,6 +116,7 @@ static int selinux_set_mapping(struct policydb *pol,
117116
while (map[j].name) {
118117
const struct security_class_mapping *p_in = map + (j++);
119118
struct selinux_mapping *p_out = out_map->mapping + j;
119+
u16 k;
120120

121121
/* An empty class string skips ahead */
122122
if (!strcmp(p_in->name, "")) {

security/selinux/ss/services.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/* Mapping for a single class */
1313
struct selinux_mapping {
1414
u16 value; /* policy value for class */
15-
unsigned int num_perms; /* number of permissions in class */
15+
u16 num_perms; /* number of permissions in class */
1616
u32 perms[sizeof(u32) * 8]; /* policy values for permissions */
1717
};
1818

0 commit comments

Comments
 (0)