conditional.c:391:4: warning: Value stored to 'i' is never read [deadcode.DeadStores] i = 0; ^ ~ conditional.c:718:2: warning: Value stored to 'len' is never read [deadcode.DeadStores] len = 0; ^ ~ conditional.c:772:2: warning: Value stored to 'len' is never read [deadcode.DeadStores] len = 0; ^ ~ services.c:89:10: warning: Value stored to 'new_stack' during its initialization is never read [deadcode.DeadStores] char **new_stack = stack; ^~~~~~~~~ ~~~~~ services.c:440:11: warning: Value stored to 'new_expr_list' during its initialization is never read [deadcode.DeadStores] char **new_expr_list = expr_list; ^~~~~~~~~~~~~ ~~~~~~~~~ ../cil/src/cil_binary.c:2230:24: warning: Value stored to 'cb_node' during its initialization is never read [deadcode.DeadStores] struct cil_tree_node *cb_node = node->cl_head; ^~~~~~~ ~~~~~~~~~~~~~ Found by clang-analyzer Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx> --- libsepol/src/conditional.c | 3 --- libsepol/src/services.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libsepol/src/conditional.c b/libsepol/src/conditional.c index 823b649a..e3ede694 100644 --- a/libsepol/src/conditional.c +++ b/libsepol/src/conditional.c @@ -388,7 +388,6 @@ int cond_normalize_expr(policydb_t * p, cond_node_t * cn) for (e = cn->expr; e != NULL; e = e->next) { switch (e->expr_type) { case COND_BOOL: - i = 0; /* see if we've already seen this bool */ if (!bool_present(e->bool, cn->bool_ids, cn->nbools)) { /* count em all but only record up to COND_MAX_BOOLS */ @@ -715,7 +714,6 @@ static int cond_read_av_list(policydb_t * p, void *fp, *ret_list = NULL; - len = 0; rc = next_entry(buf, fp, sizeof(uint32_t)); if (rc < 0) return -1; @@ -769,7 +767,6 @@ static int cond_read_node(policydb_t * p, cond_node_t * node, void *fp) node->cur_state = le32_to_cpu(buf[0]); - len = 0; rc = next_entry(buf, fp, sizeof(uint32_t)); if (rc < 0) goto err; diff --git a/libsepol/src/services.c b/libsepol/src/services.c index d647c8f5..c34bb966 100644 --- a/libsepol/src/services.c +++ b/libsepol/src/services.c @@ -86,7 +86,7 @@ static int next_stack_entry; static void push(char *expr_ptr) { if (next_stack_entry >= stack_len) { - char **new_stack = stack; + char **new_stack; int new_stack_len; if (stack_len == 0) @@ -441,7 +441,7 @@ static int constraint_expr_eval_reason(context_struct_t *scontext, for (e = constraint->expr; e; e = e->next) { /* Allocate a stack to hold expression buffer entries */ if (expr_counter >= expr_list_len) { - char **new_expr_list = expr_list; + char **new_expr_list; int new_expr_list_len; if (expr_list_len == 0) -- 2.32.0