Commit 3ac285ff authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by James Morris

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: default avatarDavidlohr Bueso <dave@gnu.org>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent e5cce6c1
...@@ -178,7 +178,7 @@ int cond_init_bool_indexes(struct policydb *p) ...@@ -178,7 +178,7 @@ int cond_init_bool_indexes(struct policydb *p)
p->bool_val_to_struct = (struct cond_bool_datum **) p->bool_val_to_struct = (struct cond_bool_datum **)
kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL); kmalloc(p->p_bools.nprim * sizeof(struct cond_bool_datum *), GFP_KERNEL);
if (!p->bool_val_to_struct) if (!p->bool_val_to_struct)
return -1; return -ENOMEM;
return 0; return 0;
} }
......
...@@ -501,8 +501,8 @@ static int policydb_index(struct policydb *p) ...@@ -501,8 +501,8 @@ static int policydb_index(struct policydb *p)
if (rc) if (rc)
goto out; goto out;
rc = -ENOMEM; rc = cond_init_bool_indexes(p);
if (cond_init_bool_indexes(p)) if (rc)
goto out; goto out;
for (i = 0; i < SYM_NUM; i++) { for (i = 0; i < SYM_NUM; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment