Skip to content

Commit f07ea1d

Browse files
WOnder93pcmoore
authored andcommitted
selinux: policydb - rename type_val_to_struct_array
The name is overly long and inconsistent with the other *_val_to_struct members. Dropping the "_array" prefix makes the code easier to read and gets rid of one line over 80 characters warning. Signed-off-by: Ondrej Mosnacek <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 2492aca commit f07ea1d

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

security/selinux/ss/policydb.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static int type_index(void *key, void *datum, void *datap)
590590
|| typdatum->bounds > p->p_types.nprim)
591591
return -EINVAL;
592592
p->sym_val_to_name[SYM_TYPES][typdatum->value - 1] = key;
593-
p->type_val_to_struct_array[typdatum->value - 1] = typdatum;
593+
p->type_val_to_struct[typdatum->value - 1] = typdatum;
594594
}
595595

596596
return 0;
@@ -732,10 +732,10 @@ static int policydb_index(struct policydb *p)
732732
if (!p->user_val_to_struct)
733733
return -ENOMEM;
734734

735-
p->type_val_to_struct_array = kvcalloc(p->p_types.nprim,
736-
sizeof(*p->type_val_to_struct_array),
737-
GFP_KERNEL);
738-
if (!p->type_val_to_struct_array)
735+
p->type_val_to_struct = kvcalloc(p->p_types.nprim,
736+
sizeof(*p->type_val_to_struct),
737+
GFP_KERNEL);
738+
if (!p->type_val_to_struct)
739739
return -ENOMEM;
740740

741741
rc = cond_init_bool_indexes(p);
@@ -781,7 +781,7 @@ void policydb_destroy(struct policydb *p)
781781
kfree(p->class_val_to_struct);
782782
kfree(p->role_val_to_struct);
783783
kfree(p->user_val_to_struct);
784-
kvfree(p->type_val_to_struct_array);
784+
kvfree(p->type_val_to_struct);
785785

786786
avtab_destroy(&p->te_avtab);
787787

@@ -1726,7 +1726,7 @@ static int type_bounds_sanity_check(void *key, void *datum, void *datap)
17261726
return -EINVAL;
17271727
}
17281728

1729-
upper = p->type_val_to_struct_array[upper->bounds - 1];
1729+
upper = p->type_val_to_struct[upper->bounds - 1];
17301730
BUG_ON(!upper);
17311731

17321732
if (upper->attribute) {

security/selinux/ss/policydb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ struct policydb {
255255
struct class_datum **class_val_to_struct;
256256
struct role_datum **role_val_to_struct;
257257
struct user_datum **user_val_to_struct;
258-
struct type_datum **type_val_to_struct_array;
258+
struct type_datum **type_val_to_struct;
259259

260260
/* type enforcement access vectors and transitions */
261261
struct avtab te_avtab;

security/selinux/ss/services.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,13 +544,13 @@ static void type_attribute_bounds_av(struct policydb *policydb,
544544
struct type_datum *target;
545545
u32 masked = 0;
546546

547-
source = policydb->type_val_to_struct_array[scontext->type - 1];
547+
source = policydb->type_val_to_struct[scontext->type - 1];
548548
BUG_ON(!source);
549549

550550
if (!source->bounds)
551551
return;
552552

553-
target = policydb->type_val_to_struct_array[tcontext->type - 1];
553+
target = policydb->type_val_to_struct[tcontext->type - 1];
554554
BUG_ON(!target);
555555

556556
memset(&lo_avd, 0, sizeof(lo_avd));
@@ -893,7 +893,7 @@ int security_bounded_transition(struct selinux_state *state,
893893

894894
index = new_context->type;
895895
while (true) {
896-
type = policydb->type_val_to_struct_array[index - 1];
896+
type = policydb->type_val_to_struct[index - 1];
897897
BUG_ON(!type);
898898

899899
/* not bounded anymore */

0 commit comments

Comments
 (0)