All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Paul Moore <paul@paul-moore.com>
Cc: James Morris <james.l.morris@oracle.com>,
	kernel-janitors@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Himangi Saraogi <himangi774@gmail.com>,
	selinux@tycho.nsa.gov, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [patch] SELinux: fix error code in policydb_init()
Date: Wed, 28 Jan 2015 15:14:18 +0000	[thread overview]
Message-ID: <54C8FCCA.9010706@tycho.nsa.gov> (raw)
In-Reply-To: <20150128064239.GB30893@mwanda>

On 01/28/2015 01:42 AM, Dan Carpenter wrote:
> If hashtab_create() returns a NULL pointer then we should return -ENOMEM
> but instead the current code returns success.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>

> 
> diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
> index bc2a586..74aa224 100644
> --- a/security/selinux/ss/policydb.c
> +++ b/security/selinux/ss/policydb.c
> @@ -289,12 +289,16 @@ static int policydb_init(struct policydb *p)
>  		goto out;
>  
>  	p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp, (1 << 10));
> -	if (!p->filename_trans)
> +	if (!p->filename_trans) {
> +		rc = -ENOMEM;
>  		goto out;
> +	}
>  
>  	p->range_tr = hashtab_create(rangetr_hash, rangetr_cmp, 256);
> -	if (!p->range_tr)
> +	if (!p->range_tr) {
> +		rc = -ENOMEM;
>  		goto out;
> +	}
>  
>  	ebitmap_init(&p->filename_trans_ttypes);
>  	ebitmap_init(&p->policycaps);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Smalley <sds@tycho.nsa.gov>
To: Dan Carpenter <dan.carpenter@oracle.com>,
	Paul Moore <paul@paul-moore.com>
Cc: James Morris <james.l.morris@oracle.com>,
	kernel-janitors@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Himangi Saraogi <himangi774@gmail.com>,
	selinux@tycho.nsa.gov, Namhyung Kim <namhyung@kernel.org>
Subject: Re: [patch] SELinux: fix error code in policydb_init()
Date: Wed, 28 Jan 2015 10:14:18 -0500	[thread overview]
Message-ID: <54C8FCCA.9010706@tycho.nsa.gov> (raw)
In-Reply-To: <20150128064239.GB30893@mwanda>

On 01/28/2015 01:42 AM, Dan Carpenter wrote:
> If hashtab_create() returns a NULL pointer then we should return -ENOMEM
> but instead the current code returns success.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by:  Stephen Smalley <sds@tycho.nsa.gov>

> 
> diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
> index bc2a586..74aa224 100644
> --- a/security/selinux/ss/policydb.c
> +++ b/security/selinux/ss/policydb.c
> @@ -289,12 +289,16 @@ static int policydb_init(struct policydb *p)
>  		goto out;
>  
>  	p->filename_trans = hashtab_create(filenametr_hash, filenametr_cmp, (1 << 10));
> -	if (!p->filename_trans)
> +	if (!p->filename_trans) {
> +		rc = -ENOMEM;
>  		goto out;
> +	}
>  
>  	p->range_tr = hashtab_create(rangetr_hash, rangetr_cmp, 256);
> -	if (!p->range_tr)
> +	if (!p->range_tr) {
> +		rc = -ENOMEM;
>  		goto out;
> +	}
>  
>  	ebitmap_init(&p->filename_trans_ttypes);
>  	ebitmap_init(&p->policycaps);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2015-01-28 15:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-28  6:42 [patch] SELinux: fix error code in policydb_init() Dan Carpenter
2015-01-28  6:42 ` Dan Carpenter
2015-01-28  6:52 ` Serge E. Hallyn
2015-01-28  6:52   ` Serge E. Hallyn
2015-01-28 15:14 ` Stephen Smalley [this message]
2015-01-28 15:14   ` Stephen Smalley
2015-01-29 20:51 ` Paul Moore
2015-01-29 20:51   ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C8FCCA.9010706@tycho.nsa.gov \
    --to=sds@tycho.nsa.gov \
    --cc=dan.carpenter@oracle.com \
    --cc=himangi774@gmail.com \
    --cc=james.l.morris@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paul@paul-moore.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.