selinux: simplify evaluate_cond_node()
authorOndrej Mosnacek <omosnace@redhat.com>
Fri, 17 Jan 2020 08:58:32 +0000 (09:58 +0100)
committerPaul Moore <paul@paul-moore.com>
Mon, 10 Feb 2020 15:49:01 +0000 (10:49 -0500)
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>
security/selinux/ss/conditional.c
security/selinux/ss/conditional.h
security/selinux/ss/services.c

index 70c378ee1a2f6ad6c03de966aa56c691b16ab3be..04593062008dfbfdd60593f0e94572183bea964b 100644 (file)
@@ -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
  * 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;
        struct cond_av_list *cur;
@@ -111,7 +111,6 @@ int evaluate_cond_node(struct policydb *p, struct cond_node *node)
                                cur->node->key.specified |= AVTAB_ENABLED;
                }
        }
-       return 0;
 }
 
 int cond_policydb_init(struct policydb *p)
index ec846e45904c8ddbe655895e6e7c5e6e4faad573..d86ef286ca84b2330801a492df1653c95b904f52 100644 (file)
@@ -75,6 +75,6 @@ void cond_compute_av(struct avtab *ctab, struct avtab_key *key,
                struct av_decision *avd, struct extended_perms *xperms);
 void cond_compute_xperms(struct avtab *ctab, struct avtab_key *key,
                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_ */
index 5cf491768142cbaaaec6befa0d0f3d5632450273..922b5e4a03e86f9113e1eda1b2f0bfa80605ef97 100644 (file)
@@ -2956,11 +2956,8 @@ int security_set_bools(struct selinux_state *state, int len, int *values)
                        policydb->bool_val_to_struct[i]->state = 0;
        }
 
-       for (cur = policydb->cond_list; cur; cur = cur->next) {
-               rc = evaluate_cond_node(policydb, cur);
-               if (rc)
-                       goto out;
-       }
+       for (cur = policydb->cond_list; cur; cur = cur->next)
+               evaluate_cond_node(policydb, cur);
 
        seqno = ++state->ss->latest_granting;
        rc = 0;
@@ -3013,11 +3010,8 @@ static int security_preserve_bools(struct selinux_state *state,
                if (booldatum)
                        booldatum->state = bvalues[i];
        }
-       for (cur = policydb->cond_list; cur; cur = cur->next) {
-               rc = evaluate_cond_node(policydb, cur);
-               if (rc)
-                       goto out;
-       }
+       for (cur = policydb->cond_list; cur; cur = cur->next)
+               evaluate_cond_node(policydb, cur);
 
 out:
        if (bnames) {