libsepol: cil: always initialize __cil_permx_to_sepol_class_perms() result

clang warns that __cil_permx_to_sepol_class_perms() return value, rc,
may be unitialized:

    ../cil/src/cil_binary.c:4188:9: error: variable 'rc' may be
    uninitialized when used here [-Werror,-Wconditional-uninitialized]
            return rc;
                   ^~
    ../cil/src/cil_binary.c:4148:8: note: initialize the variable 'rc'
    to silence this warning
            int rc;
                  ^
                   = 0

This theoretically happens when cil_expand_class(permx->obj) returns an
empty list.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2016-01-31 11:36:36 +01:00 committed by Steve Lawrence
parent f7088b70af
commit 1bfb1a4ffd
1 changed files with 1 additions and 1 deletions

View File

@ -4145,7 +4145,7 @@ exit:
static int __cil_permx_to_sepol_class_perms(policydb_t *pdb, struct cil_permissionx *permx, class_perm_node_t **sepol_class_perms)
{
int rc;
int rc = SEPOL_OK;
struct cil_list *class_list = NULL;
struct cil_list_item *c;
class_datum_t *sepol_obj = NULL;