Skip to content

Commit 06c2efe

Browse files
Ondrej Mosnacekpcmoore
authored andcommitted
selinux: simplify evaluate_cond_node()
It never fails, so it can just return void. Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com> Reviewed-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent e9c38f9 commit 06c2efe

3 files changed

Lines changed: 6 additions & 13 deletions

File tree

‎security/selinux/ss/conditional.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int cond_evaluate_expr(struct policydb *p, struct cond_expr *expr)
8585
* list appropriately. If the result of the expression is undefined
8686
* all of the rules are disabled for safety.
8787
*/
88-
int evaluate_cond_node(struct policydb *p, struct cond_node *node)
88+
void evaluate_cond_node(struct policydb *p, struct cond_node *node)
8989
{
9090
int new_state;
9191
struct cond_av_list *cur;
@@ -111,7 +111,6 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
111111
cur->node->key.specified |= AVTAB_ENABLED;
112112
}
113113
}
114-
return 0;
115114
}
116115

117116
int cond_policydb_init(struct policydb *p)

‎security/selinux/ss/conditional.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
7575
struct av_decision *avd, struct extended_perms *xperms);
7676
void cond_compute_xperms(struct avtab *ctab, struct avtab_key *key,
7777
struct extended_perms_decision *xpermd);
78-
int evaluate_cond_node(struct policydb *p, struct cond_node *node);
78+
void evaluate_cond_node(struct policydb *p, struct cond_node *node);
7979

8080
#endif /* _CONDITIONAL_H_ */

‎security/selinux/ss/services.c‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,11 +2956,8 @@ int security_set_bools(struct selinux_state *state, int len, int *values)
29562956
policydb->bool_val_to_struct[i]->state = 0;
29572957
}
29582958

2959-
for (cur = policydb->cond_list; cur; cur = cur->next) {
2960-
rc = evaluate_cond_node(policydb, cur);
2961-
if (rc)
2962-
goto out;
2963-
}
2959+
for (cur = policydb->cond_list; cur; cur = cur->next)
2960+
evaluate_cond_node(policydb, cur);
29642961

29652962
seqno = ++state->ss->latest_granting;
29662963
rc = 0;
@@ -3013,11 +3010,8 @@ static int security_preserve_bools(struct selinux_state *state,
30133010
if (booldatum)
30143011
booldatum->state = bvalues[i];
30153012
}
3016-
for (cur = policydb->cond_list; cur; cur = cur->next) {
3017-
rc = evaluate_cond_node(policydb, cur);
3018-
if (rc)
3019-
goto out;
3020-
}
3013+
for (cur = policydb->cond_list; cur; cur = cur->next)
3014+
evaluate_cond_node(policydb, cur);
30213015

30223016
out:
30233017
if (bnames) {

0 commit comments

Comments
 (0)