All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selinux: Fix an uninitialized variable bug
@ 2017-03-31 15:21 ` Dan Carpenter
  0 siblings, 0 replies; 24+ messages in thread
From: Dan Carpenter @ 2017-03-31 15:21 UTC (permalink / raw)
  To: Paul Moore, Markus Elfring
  Cc: Stephen Smalley, Eric Paris, James Morris, Serge E. Hallyn,
	William Roberts, selinux, linux-security-module, kernel-janitors

We removed this initialization as a cleanup but it is probably required.

The concern is that "nel" can be zero.  I'm not an expert on SELinux
code but I think it looks possible to write an SELinux policy which
triggers this bug.  GCC doesn't catch this, but my static checker does.

Fixes: 9c312e79d6af ("selinux: Delete an unnecessary variable initialisation in range_read()")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 658247f98dc1..0080122760ad 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -1832,7 +1832,7 @@ u32 string_to_av_perm(struct policydb *p, u16 tclass, const char *name)
 
 static int range_read(struct policydb *p, void *fp)
 {
-	struct range_trans *rt;
+	struct range_trans *rt = NULL;
 	struct mls_range *r = NULL;
 	int i, rc;
 	__le32 buf[2];

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

end of thread, other threads:[~2017-04-04  0:03 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-31 15:21 [PATCH] selinux: Fix an uninitialized variable bug Dan Carpenter
2017-03-31 15:21 ` Dan Carpenter
2017-03-31 15:21 ` Dan Carpenter
2017-03-31 15:52 ` Stephen Smalley
2017-03-31 15:52   ` Stephen Smalley
2017-03-31 15:52   ` Stephen Smalley
2017-03-31 19:18   ` Paul Moore
2017-03-31 19:18     ` Paul Moore
2017-03-31 19:18     ` Paul Moore
2017-04-01  6:40     ` selinux: Fix an uninitialized variable bug in range_read() SF Markus Elfring
2017-04-01  6:40       ` SF Markus Elfring
2017-04-01  6:40       ` SF Markus Elfring
2017-04-01 14:52       ` Paul Moore
2017-04-01 14:52         ` Paul Moore
2017-04-01 14:52         ` Paul Moore
2017-04-03  1:10     ` [PATCH] selinux: Fix an uninitialized variable bug James Morris
2017-04-03  1:10       ` James Morris
2017-04-03  1:10       ` James Morris
2017-04-03 21:45       ` Paul Moore
2017-04-03 21:45         ` Paul Moore
2017-04-03 21:45         ` Paul Moore
2017-04-04  0:03         ` James Morris
2017-04-04  0:03           ` James Morris
2017-04-04  0:03           ` James Morris

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.