Commit f07ea1d4 authored by Ondrej Mosnacek's avatar Ondrej Mosnacek Committed by Paul Moore
Browse files

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: default avatarOndrej Mosnacek <omosnace@redhat.com>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent 2492acaf
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -590,7 +590,7 @@ static int type_index(void *key, void *datum, void *datap)
		    || typdatum->bounds > p->p_types.nprim)
		    || typdatum->bounds > p->p_types.nprim)
			return -EINVAL;
			return -EINVAL;
		p->sym_val_to_name[SYM_TYPES][typdatum->value - 1] = key;
		p->sym_val_to_name[SYM_TYPES][typdatum->value - 1] = key;
		p->type_val_to_struct_array[typdatum->value - 1] = typdatum;
		p->type_val_to_struct[typdatum->value - 1] = typdatum;
	}
	}


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


	p->type_val_to_struct_array = kvcalloc(p->p_types.nprim,
	p->type_val_to_struct = kvcalloc(p->p_types.nprim,
					       sizeof(*p->type_val_to_struct_array),
					 sizeof(*p->type_val_to_struct),
					 GFP_KERNEL);
					 GFP_KERNEL);
	if (!p->type_val_to_struct_array)
	if (!p->type_val_to_struct)
		return -ENOMEM;
		return -ENOMEM;


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


	avtab_destroy(&p->te_avtab);
	avtab_destroy(&p->te_avtab);


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


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


		if (upper->attribute) {
		if (upper->attribute) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -255,7 +255,7 @@ struct policydb {
	struct class_datum **class_val_to_struct;
	struct class_datum **class_val_to_struct;
	struct role_datum **role_val_to_struct;
	struct role_datum **role_val_to_struct;
	struct user_datum **user_val_to_struct;
	struct user_datum **user_val_to_struct;
	struct type_datum **type_val_to_struct_array;
	struct type_datum **type_val_to_struct;


	/* type enforcement access vectors and transitions */
	/* type enforcement access vectors and transitions */
	struct avtab te_avtab;
	struct avtab te_avtab;
+3 −3
Original line number Original line Diff line number Diff line
@@ -544,13 +544,13 @@ static void type_attribute_bounds_av(struct policydb *policydb,
	struct type_datum *target;
	struct type_datum *target;
	u32 masked = 0;
	u32 masked = 0;


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


	if (!source->bounds)
	if (!source->bounds)
		return;
		return;


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


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


	index = new_context->type;
	index = new_context->type;
	while (true) {
	while (true) {
		type = policydb->type_val_to_struct_array[index - 1];
		type = policydb->type_val_to_struct[index - 1];
		BUG_ON(!type);
		BUG_ON(!type);


		/* not bounded anymore */
		/* not bounded anymore */