[PATCH 2/2] libsepol: Remove assertion and comment from discard_tunables()
James Carter <[email protected]>
| Newsgroups | org.kernel.vger.selinux |
|---|---|
| Message-ID | <[email protected]> |
Policy validation ensures that there is never a mixture of tunables and booleans in one expression, this means that the assertion in discard_tunables() is not needed. Remove the assertion and the comment (which is incorrect) above the assertion. Since the variable "tunables" was only used in the assertion, remove it as well. Signed-off-by: James Carter <[email protected]> --- libsepol/src/expand.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c index 18718973..f7ff61cd 100644 --- a/libsepol/src/expand.c +++ b/libsepol/src/expand.c @@ -3194,7 +3194,7 @@ static void discard_tunables(sepol_handle_t *sh, policydb_t *pol) for (cur_node = decl->cond_list; cur_node != NULL; cur_node = cur_node->next) { - int booleans = 0, tunables = 0; + int booleans = 0; cond_bool_datum_t *booldatum; for (cur_expr = cur_node->expr; cur_expr != NULL; @@ -3205,7 +3205,6 @@ static void discard_tunables(sepol_handle_t *sh, policydb_t *pol) [cur_expr->boolean - 1]; if (booldatum->flags & COND_BOOL_FLAGS_TUNABLE) { - tunables++; if (preserve_tunables) booldatum->flags &= ~COND_BOOL_FLAGS_TUNABLE; @@ -3214,13 +3213,6 @@ static void discard_tunables(sepol_handle_t *sh, policydb_t *pol) } } - /* bool_copy_callback() at link phase has ensured - * that no mixture of tunables and booleans in one - * expression. However, this would be broken by the - * request to preserve tunables */ - if (!preserve_tunables) - assert(!(booleans && tunables)); - if (booleans || preserve_tunables) { cur_node->flags &= ~COND_NODE_FLAGS_TUNABLE; } else { -- 2.55.0