* [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab
@ 2020-08-19 10:42 Colin King
2020-08-19 12:21 ` Stephen Smalley
2020-08-19 13:17 ` Paul Moore
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2020-08-19 10:42 UTC (permalink / raw)
To: Paul Moore, Stephen Smalley, Eric Paris, Ondrej Mosnacek, selinux
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.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@canonical.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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab
2020-08-19 10:42 [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab Colin King
@ 2020-08-19 12:21 ` Stephen Smalley
2020-08-19 13:17 ` Paul Moore
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Smalley @ 2020-08-19 12:21 UTC (permalink / raw)
To: Colin King, Paul Moore, Eric Paris, Ondrej Mosnacek, selinux
Cc: kernel-janitors, linux-kernel
On 8/19/20 6:42 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab
2020-08-19 10:42 [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab Colin King
2020-08-19 12:21 ` Stephen Smalley
@ 2020-08-19 13:17 ` Paul Moore
1 sibling, 0 replies; 3+ messages in thread
From: Paul Moore @ 2020-08-19 13:17 UTC (permalink / raw)
To: Colin King
Cc: Stephen Smalley, Eric Paris, Ondrej Mosnacek, selinux,
kernel-janitors, linux-kernel
On Wed, Aug 19, 2020 at 6:42 AM Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.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@canonical.com>
> ---
> security/selinux/ss/services.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks Colin, merged into selinux/next.
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-19 13:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 10:42 [PATCH][next] selinux: fix allocation failure check on newpolicy->sidtab Colin King
2020-08-19 12:21 ` Stephen Smalley
2020-08-19 13:17 ` Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).