All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] SELinux: fix error code in policydb_init()
@ 2015-01-28  6:42 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2015-01-28  6:42 UTC (permalink / raw)
  To: Paul Moore
  Cc: selinux, kernel-janitors, linux-security-module, Himangi Saraogi,
	James Morris, Namhyung Kim, Stephen Smalley

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);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-01-29 20:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-01-28 15:14   ` Stephen Smalley
2015-01-29 20:51 ` Paul Moore
2015-01-29 20:51   ` Paul Moore

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.