selinux: fix error codes in cond_policydb_init()
Subsystems (2)
PATCH 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.
security/selinux/ss/conditional.c +6 -2
@@ -117,10 +117,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)int cond_policydb_init (struct policydb *p) { +int ret; + p->bool_val_to_struct =NULL ; p->cond_list =NULL ; -if (avtab_init (&p->te_cond_avtab)) -return -1 ; + + ret =avtab_init (&p->te_cond_avtab); +if (ret <0 ) +return ret;return 0 ; }
Quoted 11 lines · Dan Carpenter
It's better to propagate the error code from
avtab_init()instead of returning -1 (-EPERM). It turns out thatavtab_init()never fails so this patch doesn't change how the code runs but it's still a clean up.Signed-off-by Dan Carpenter <[email protected]>security/selinux/ss/conditional.c +0
-0
security/selinux/ss/conditional.c int evaluate_cond_node(struct policydb *p, struct cond_node *node) · line 120
Quoted 4 lines
security/selinux/ss/conditional.c +1
-0@@ -117,10 +117,14 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node) int cond_policydb_init(struct policydb *p) { + int ret;
I know, I'm being pedantic, but int rc, not int ret; All of the rest of the code uses rc.
security/selinux/ss/conditional.c int evaluate_cond_node(struct policydb *p, struct cond_node *node) · line 126
Quoted 8 lines
security/selinux/ss/conditional.c +4
-2+ p->bool_val_to_struct = NULL; p->cond_list = NULL; - if (avtab_init(&p->te_cond_avtab)) - return -1; + + ret = avtab_init(&p->te_cond_avtab); + if (ret < 0)
if (rc) not if (rc < 0)
security/selinux/ss/conditional.c int evaluate_cond_node(struct policydb *p, struct cond_node *node) · line 130
Quoted 4 lines
security/selinux/ss/conditional.c +1
-0+ return ret; return 0; }
-Eric
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html