From: Dan Carpenter <dan.carpenter@oracle.com>
To: Paul Moore <paul@paul-moore.com>
Cc: selinux@tycho.nsa.gov, kernel-janitors@vger.kernel.org,
linux-security-module@vger.kernel.org,
Himangi Saraogi <himangi774@gmail.com>,
James Morris <james.l.morris@oracle.com>,
Namhyung Kim <namhyung@kernel.org>,
Stephen Smalley <sds@tycho.nsa.gov>
Subject: [patch] SELinux: fix error code in policydb_init()
Date: Wed, 28 Jan 2015 06:42:39 +0000 [thread overview]
Message-ID: <20150128064239.GB30893@mwanda> (raw)
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>
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);
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Paul Moore <paul@paul-moore.com>
Cc: selinux@tycho.nsa.gov, kernel-janitors@vger.kernel.org,
linux-security-module@vger.kernel.org,
Himangi Saraogi <himangi774@gmail.com>,
James Morris <james.l.morris@oracle.com>,
Namhyung Kim <namhyung@kernel.org>,
Stephen Smalley <sds@tycho.nsa.gov>
Subject: [patch] SELinux: fix error code in policydb_init()
Date: Wed, 28 Jan 2015 09:42:39 +0300 [thread overview]
Message-ID: <20150128064239.GB30893@mwanda> (raw)
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>
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);
next reply other threads:[~2015-01-28 6:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-28 6:42 Dan Carpenter [this message]
2015-01-28 6:42 ` [patch] SELinux: fix error code in policydb_init() 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
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=20150128064239.GB30893@mwanda \
--to=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=sds@tycho.nsa.gov \
--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.