Skip to contentSkip to conversation

libsepol/cil: Return SEPOL_ERR on failure to set bit

PATCH In review James Carter 2 participants 3 messages Jul 27 SELinux security module

lore
Share & tools
lore
#0 lore raw

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

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.

---
 libsepol/cil/src/cil_binary.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libsepol/cil/src/cil_binary.c +2 -2
index caf2d987..7ec3e781 100644
@@ -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;
Signature · 1 line
2.55.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · James Carter

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.

Quoted 29 lines
---
 libsepol/cil/src/cil_binary.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
libsepol/cil/src/cil_binary.c +2 -3
index caf2d987..7ec3e781 100644
@@ -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

maintainer
#2 lore raw
Quoted 7 lines · Stephen Smalley
Quoted 5 lines · James Carter

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.

Quoted 5 lines
Quoted 3 lines

Return SEPOL_ERR instead of rc when ebitmap_set_bit() fails.

Merged.