[PATCH 2/3] libsepol: optimize inner loop in build_type_map()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Only attributes can be a superset of another attribute, so we can skip
non-attributes right away.

Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---
 libsepol/src/optimize.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libsepol/src/optimize.c b/libsepol/src/optimize.c
index 4d835d47..2b5102af 100644
--- a/libsepol/src/optimize.c
+++ b/libsepol/src/optimize.c
@@ -50,6 +50,9 @@ static ebitmap_t *build_type_map(const policydb_t *p)
 			for (k = 0; k < p->p_types.nprim; k++) {
 				ebitmap_t *types_k = &p->attr_type_map[k];
 
+				if (p->type_val_to_struct[k]->flavor != TYPE_ATTRIB)
+					continue;
+
 				if (ebitmap_contains(types_k, types_i)) {
 					if (ebitmap_set_bit(&map[i], k, 1))
 						goto err;
-- 
2.24.1




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux