Commit 06c2efe2 authored by Ondrej Mosnacek's avatar Ondrej Mosnacek Committed by Paul Moore

selinux: simplify evaluate_cond_node()

It never fails, so it can just return void.
Signed-off-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
Reviewed-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
parent e9c38f9f
...@@ -85,7 +85,7 @@ static int cond_evaluate_expr(struct policydb *p, struct cond_expr *expr) ...@@ -85,7 +85,7 @@ static int cond_evaluate_expr(struct policydb *p, struct cond_expr *expr)
* list appropriately. If the result of the expression is undefined * list appropriately. If the result of the expression is undefined
* all of the rules are disabled for safety. * all of the rules are disabled for safety.
*/ */
int evaluate_cond_node(struct policydb *p, struct cond_node *node) void evaluate_cond_node(struct policydb *p, struct cond_node *node)
{ {
int new_state; int new_state;
struct cond_av_list *cur; struct cond_av_list *cur;
...@@ -111,7 +111,6 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node) ...@@ -111,7 +111,6 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
cur->node->key.specified |= AVTAB_ENABLED; cur->node->key.specified |= AVTAB_ENABLED;
} }
} }
return 0;
} }
int cond_policydb_init(struct policydb *p) int cond_policydb_init(struct policydb *p)
......
...@@ -75,6 +75,6 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key, ...@@ -75,6 +75,6 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
struct av_decision *avd, struct extended_perms *xperms); struct av_decision *avd, struct extended_perms *xperms);
void cond_compute_xperms(struct avtab *ctab, struct avtab_key *key, void cond_compute_xperms(struct avtab *ctab, struct avtab_key *key,
struct extended_perms_decision *xpermd); struct extended_perms_decision *xpermd);
int evaluate_cond_node(struct policydb *p, struct cond_node *node); void evaluate_cond_node(struct policydb *p, struct cond_node *node);
#endif /* _CONDITIONAL_H_ */ #endif /* _CONDITIONAL_H_ */
...@@ -2956,11 +2956,8 @@ int security_set_bools(struct selinux_state *state, int len, int *values) ...@@ -2956,11 +2956,8 @@ int security_set_bools(struct selinux_state *state, int len, int *values)
policydb->bool_val_to_struct[i]->state = 0; policydb->bool_val_to_struct[i]->state = 0;
} }
for (cur = policydb->cond_list; cur; cur = cur->next) { for (cur = policydb->cond_list; cur; cur = cur->next)
rc = evaluate_cond_node(policydb, cur); evaluate_cond_node(policydb, cur);
if (rc)
goto out;
}
seqno = ++state->ss->latest_granting; seqno = ++state->ss->latest_granting;
rc = 0; rc = 0;
...@@ -3013,11 +3010,8 @@ static int security_preserve_bools(struct selinux_state *state, ...@@ -3013,11 +3010,8 @@ static int security_preserve_bools(struct selinux_state *state,
if (booldatum) if (booldatum)
booldatum->state = bvalues[i]; booldatum->state = bvalues[i];
} }
for (cur = policydb->cond_list; cur; cur = cur->next) { for (cur = policydb->cond_list; cur; cur = cur->next)
rc = evaluate_cond_node(policydb, cur); evaluate_cond_node(policydb, cur);
if (rc)
goto out;
}
out: out:
if (bnames) { if (bnames) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment