]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
selinux: Fix an uninitialized variable bug
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 31 Mar 2017 15:21:18 +0000 (18:21 +0300)
committerPaul Moore <paul@paul-moore.com>
Fri, 31 Mar 2017 19:16:18 +0000 (15:16 -0400)
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>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/policydb.c

index 658247f98dc13671d747d97b0e55087d3b1e8402..0080122760ad4ad79fb5b84bada231eff4e7ce83 100644 (file)
@@ -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];