lkml.org 
[lkml]   [2011]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/3] selinux: return -ENOMEM when memory allocation fails
On Thu, 20 Jan 2011, Davidlohr Bueso wrote:

> From: Davidlohr Bueso <dave@gnu.org>
>
> Signed-off-by: Davidlohr Bueso <dave@gnu.org>
> ---
> security/selinux/ss/conditional.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
> index c3f845c..a533732 100644
> --- a/security/selinux/ss/conditional.c
> +++ b/security/selinux/ss/conditional.c
> @@ -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;

The caller has already set -ENOMEM, so the code should probably be updated
there, too, e.g.

rc = cond_init_bool_indexes();
if (rc)
goto out;


--
James Morris
<jmorris@namei.org>


\
 
 \ /
  Last update: 2011-01-21 01:09    [from the cache]
©2003-2011 Jasper Spaans