[PATCH] libsepol/cil: Return SEPOL_ERR on failure to set bit

James Carter <[email protected]> Mon, 27 Jul 2026 13:38:54 -0400
Newsgroups org.kernel.vger.selinux
Message-ID <[email protected]>
The functions cil_typepermissive_to_policydb() and
cil_typeneveraudit_to_policydb() return rc when ebitmap_set_bit()
fails, but the rc value at the point is SEPOL_OK.

Return SEPOL_ERR instead of rc when ebitmap_set_bit() fails.

Signed-off-by: James Carter <[email protected]>
---
 libsepol/cil/src/cil_binary.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libsepol/cil/src/cil_binary.c b/libsepol/cil/src/cil_binary.c
index caf2d987..7ec3e781 100644
--- a/libsepol/cil/src/cil_binary.c
+++ b/libsepol/cil/src/cil_binary.c
@@ -614,7 +614,7 @@ int cil_typepermissive_to_policydb(policydb_t *pdb,
 		return rc;
 
 	if (ebitmap_set_bit(&pdb->permissive_map, sepol_type->s.value, 1)) {
-		return rc;
+		return SEPOL_ERR;
 	}
 
 	return SEPOL_OK;
@@ -632,7 +632,7 @@ int cil_typeneveraudit_to_policydb(policydb_t *pdb,
 		return rc;
 
 	if (ebitmap_set_bit(&pdb->neveraudit_map, sepol_type->s.value, 1)) {
-		return rc;
+		return SEPOL_ERR;
 	}
 
 	return SEPOL_OK;
-- 
2.55.0