selinux: return -ENOMEM when memory allocation fails

Return -ENOMEM when memory allocation fails in cond_init_bool_indexes,
correctly propagating error code to caller.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: James Morris <jmorris@namei.org>
This commit is contained in:
Davidlohr Bueso 2011-01-21 12:28:04 -03:00 committed by James Morris
parent e5cce6c13c
commit 3ac285ff23
2 changed files with 3 additions and 3 deletions

View File

@ -178,7 +178,7 @@ int cond_init_bool_indexes(struct policydb *p)
p->bool_val_to_struct = (struct cond_bool_datum **)
kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL);
if (!p->bool_val_to_struct)
return -1;
return -ENOMEM;
return 0;
}

View File

@ -501,8 +501,8 @@ static int policydb_index(struct policydb *p)
if (rc)
goto out;
rc = -ENOMEM;
if (cond_init_bool_indexes(p))
rc = cond_init_bool_indexes(p);
if (rc)
goto out;
for (i = 0; i < SYM_NUM; i++) {