* [PATCH -next] selinux: fix warning Comparison to bool
@ 2020-04-14 8:18 Zou Wei
2020-04-14 22:05 ` Paul Moore
0 siblings, 1 reply; 2+ messages in thread
From: Zou Wei @ 2020-04-14 8:18 UTC (permalink / raw)
To: paul, stephen.smalley.work, eparis, selinux, linux-kernel; +Cc: Zou Wei
fix below warnings reported by coccicheck
security/selinux/ss/mls.c:539:39-43: WARNING: Comparison to bool
security/selinux/ss/services.c:1815:46-50: WARNING: Comparison to bool
security/selinux/ss/services.c:1827:46-50: WARNING: Comparison to bool
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
security/selinux/ss/mls.c | 2 +-
security/selinux/ss/services.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c
index ec5e3d1..6a5d7d0 100644
--- a/security/selinux/ss/mls.c
+++ b/security/selinux/ss/mls.c
@@ -536,7 +536,7 @@ int mls_compute_sid(struct policydb *p,
/* Fallthrough */
case AVTAB_CHANGE:
- if ((tclass == p->process_class) || (sock == true))
+ if ((tclass == p->process_class) || sock)
/* Use the process MLS attributes. */
return mls_context_cpy(newcontext, scontext);
else
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 8ad34fd..3b592d1 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -1812,7 +1812,7 @@ static int security_compute_sid(struct selinux_state *state,
} else if (cladatum && cladatum->default_role == DEFAULT_TARGET) {
newcontext.role = tcontext->role;
} else {
- if ((tclass == policydb->process_class) || (sock == true))
+ if ((tclass == policydb->process_class) || sock)
newcontext.role = scontext->role;
else
newcontext.role = OBJECT_R_VAL;
@@ -1824,7 +1824,7 @@ static int security_compute_sid(struct selinux_state *state,
} else if (cladatum && cladatum->default_type == DEFAULT_TARGET) {
newcontext.type = tcontext->type;
} else {
- if ((tclass == policydb->process_class) || (sock == true)) {
+ if ((tclass == policydb->process_class) || sock) {
/* Use the type of process. */
newcontext.type = scontext->type;
} else {
--
2.6.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] selinux: fix warning Comparison to bool
2020-04-14 8:18 [PATCH -next] selinux: fix warning Comparison to bool Zou Wei
@ 2020-04-14 22:05 ` Paul Moore
0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2020-04-14 22:05 UTC (permalink / raw)
To: Zou Wei; +Cc: Stephen Smalley, Eric Paris, selinux, linux-kernel
On Tue, Apr 14, 2020 at 4:12 AM Zou Wei <zou_wei@huawei.com> wrote:
>
> fix below warnings reported by coccicheck
>
> security/selinux/ss/mls.c:539:39-43: WARNING: Comparison to bool
> security/selinux/ss/services.c:1815:46-50: WARNING: Comparison to bool
> security/selinux/ss/services.c:1827:46-50: WARNING: Comparison to bool
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
> security/selinux/ss/mls.c | 2 +-
> security/selinux/ss/services.c | 4 ++--
> 2 files changed, 3 insertions(+), 3 deletions(-)
Merged into selinux/next, thanks.
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-14 22:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 8:18 [PATCH -next] selinux: fix warning Comparison to bool Zou Wei
2020-04-14 22:05 ` 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).