[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200819104256.51499-1-colin.king@canonical.com>
Date: Wed, 19 Aug 2020 11:42:56 +0100
From: Colin King <colin.king@...onical.com>
To: Paul Moore <paul@...l-moore.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>,
Ondrej Mosnacek <omosnace@...hat.com>, selinux@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab
From: Colin Ian King <colin.king@...onical.com>
The allocation check of newpolicy->sidtab is null checking if
newpolicy is null and not newpolicy->sidtab. Fix this.
Addresses-Coverity: ("Logically dead code")
Fixes: c7c556f1e81b ("selinux: refactor changing booleans")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
security/selinux/ss/services.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index f6f78c65f53f..d310910fb639 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2224,7 +2224,7 @@ int security_load_policy(struct selinux_state *state, void *data, size_t len,
return -ENOMEM;
newpolicy->sidtab = kzalloc(sizeof(*newpolicy->sidtab), GFP_KERNEL);
- if (!newpolicy)
+ if (!newpolicy->sidtab)
goto err;
rc = policydb_read(&newpolicy->policydb, fp);
--
2.27.0
Powered by blists - more mailing lists