Skip to content

Commit

Permalink
selinux: return -ENOMEM when memory allocation fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Davidlohr Bueso authored and James Morris committed Jan 24, 2011
1 parent e5cce6c commit 3ac285f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion security/selinux/ss/conditional.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 3ac285f

Please sign in to comment.