Skip to contentSkip to conversation

libsepol: Skip aliases when creating the type_attr_map

PATCH In review James Carter 2 participants 3 messages Aug 12 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsepol: Skip aliases when creating the type_attr_map

Aliases that have primary == 0 share the same value as their primary, so there is no need to process them when creating the type_attr_map.

Skip aliases with primary == 0 when creating the type_attr_map.

---
 libsepol/src/expand.c | 4 ++++
 1 file changed, 4 insertions(+)
libsepol/src/expand.c +4 -0
index 3d5bae83..18718973 100644
@@ -2646,6 +2646,10 @@ static int type_attr_map(hashtab_key_t key __attribute__((unused)),
 	type = (type_datum_t *)datum;
 	value = type->s.value;
 
+	/* Skip aliases since they have the same value as their primary */
+	if (!type->primary)
+		return 0;
+
 	if (type->flavor == TYPE_ATTRIB) {
 		if (!(type->flags & TYPE_FLAGS_EXPAND_ATTR_TRUE)) {
 			if (ebitmap_cpy(&p->attr_type_map[value - 1],
Signature · 1 line
2.55.0