summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOndrej Mosnacek <omosnace@redhat.com>2019-07-29 04:41:17 -0400
committerPaul Moore <paul@paul-moore.com>2019-08-05 16:21:06 -0400
commitf07ea1d4eda2574c6b0f99576db61c86ec27ff5b (patch)
tree2ca17a74559515805660fe0e3e91ee90812069bc
parent2492acaf1e53a13a528e31769aa3df15b4d9f6ef (diff)
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 <omosnace@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--security/selinux/ss/policydb.c14
-rw-r--r--security/selinux/ss/policydb.h2
-rw-r--r--security/selinux/ss/services.c6
3 files changed, 11 insertions, 11 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 943c39b07bbb..a9dabe563ea6 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -590,7 +590,7 @@ static int type_index(void *key, void *datum, void *datap)
590 || typdatum->bounds > p->p_types.nprim) 590 || typdatum->bounds > p->p_types.nprim)
591 return -EINVAL; 591 return -EINVAL;
592 p->sym_val_to_name[SYM_TYPES][typdatum->value - 1] = key; 592 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;
594 } 594 }
595 595
596 return 0; 596 return 0;
@@ -732,10 +732,10 @@ static int policydb_index(struct policydb *p)
732 if (!p->user_val_to_struct) 732 if (!p->user_val_to_struct)
733 return -ENOMEM; 733 return -ENOMEM;
734 734
735 p->type_val_to_struct_array = kvcalloc(p->p_types.nprim, 735 p->type_val_to_struct = kvcalloc(p->p_types.nprim,
736 sizeof(*p->type_val_to_struct_array), 736 sizeof(*p->type_val_to_struct),
737 GFP_KERNEL); 737 GFP_KERNEL);
738 if (!p->type_val_to_struct_array) 738 if (!p->type_val_to_struct)
739 return -ENOMEM; 739 return -ENOMEM;
740 740
741 rc = cond_init_bool_indexes(p); 741 rc = cond_init_bool_indexes(p);
@@ -781,7 +781,7 @@ void policydb_destroy(struct policydb *p)
781 kfree(p->class_val_to_struct); 781 kfree(p->class_val_to_struct);
782 kfree(p->role_val_to_struct); 782 kfree(p->role_val_to_struct);
783 kfree(p->user_val_to_struct); 783 kfree(p->user_val_to_struct);
784 kvfree(p->type_val_to_struct_array); 784 kvfree(p->type_val_to_struct);
785 785
786 avtab_destroy(&p->te_avtab); 786 avtab_destroy(&p->te_avtab);
787 787
@@ -1726,7 +1726,7 @@ static int type_bounds_sanity_check(void *key, void *datum, void *datap)
1726 return -EINVAL; 1726 return -EINVAL;
1727 } 1727 }
1728 1728
1729 upper = p->type_val_to_struct_array[upper->bounds - 1]; 1729 upper = p->type_val_to_struct[upper->bounds - 1];
1730 BUG_ON(!upper); 1730 BUG_ON(!upper);
1731 1731
1732 if (upper->attribute) { 1732 if (upper->attribute) {
diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h
index 27039149ff0a..05fc672831aa 100644
--- a/security/selinux/ss/policydb.h
+++ b/security/selinux/ss/policydb.h
@@ -255,7 +255,7 @@ struct policydb {
255 struct class_datum **class_val_to_struct; 255 struct class_datum **class_val_to_struct;
256 struct role_datum **role_val_to_struct; 256 struct role_datum **role_val_to_struct;
257 struct user_datum **user_val_to_struct; 257 struct user_datum **user_val_to_struct;
258 struct type_datum **type_val_to_struct_array; 258 struct type_datum **type_val_to_struct;
259 259
260 /* type enforcement access vectors and transitions */ 260 /* type enforcement access vectors and transitions */
261 struct avtab te_avtab; 261 struct avtab te_avtab;
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index d3a8f6fbc552..ca56cd045bf9 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -544,13 +544,13 @@ static void type_attribute_bounds_av(struct policydb *policydb,
544 struct type_datum *target; 544 struct type_datum *target;
545 u32 masked = 0; 545 u32 masked = 0;
546 546
547 source = policydb->type_val_to_struct_array[scontext->type - 1]; 547 source = policydb->type_val_to_struct[scontext->type - 1];
548 BUG_ON(!source); 548 BUG_ON(!source);
549 549
550 if (!source->bounds) 550 if (!source->bounds)
551 return; 551 return;
552 552
553 target = policydb->type_val_to_struct_array[tcontext->type - 1]; 553 target = policydb->type_val_to_struct[tcontext->type - 1];
554 BUG_ON(!target); 554 BUG_ON(!target);
555 555
556 memset(&lo_avd, 0, sizeof(lo_avd)); 556 memset(&lo_avd, 0, sizeof(lo_avd));
@@ -893,7 +893,7 @@ int security_bounded_transition(struct selinux_state *state,
893 893
894 index = new_context->type; 894 index = new_context->type;
895 while (true) { 895 while (true) {
896 type = policydb->type_val_to_struct_array[index - 1]; 896 type = policydb->type_val_to_struct[index - 1];
897 BUG_ON(!type); 897 BUG_ON(!type);
898 898
899 /* not bounded anymore */ 899 /* not bounded anymore */