Skip to contentSkip to conversation

selinux: fix error codes in cond_policydb_init()

PATCH In review Dan Carpenter 1 participant 1 message Jun 18, 2010 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/7 selinux: fix error codes in cond_policydb_init()

It's better to propagate the error code from avtab_init() instead of returning -1 (-EPERM). It turns out that avtab_init() never fails so this patch doesn't change how the code runs but it's still a clean up.

---
V2: used "ret" instead of "rc"

    used "if (rc)" instead of "if (rc < 0)"
security/selinux/ss/conditional.c +6 -2
index 9804df3..a7273bd 100644
@@ -117,10 +117,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
 
 int cond_policydb_init(struct policydb *p)
 {
+	int rc;
+
 	p->bool_val_to_struct = NULL;
 	p->cond_list = NULL;
-	if (avtab_init(&p->te_cond_avtab))
-		return -1;
+
+	rc = avtab_init(&p->te_cond_avtab);
+	if (rc)
+		return rc;
 
 	return 0;
 }

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.