[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1586852287-67588-1-git-send-email-zou_wei@huawei.com>
Date: Tue, 14 Apr 2020 16:18:07 +0800
From: Zou Wei <zou_wei@...wei.com>
To: <paul@...l-moore.com>, <stephen.smalley.work@...il.com>,
<eparis@...isplace.org>, <selinux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: Zou Wei <zou_wei@...wei.com>
Subject: [PATCH -next] selinux: fix warning Comparison to bool
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@...wei.com>
Signed-off-by: Zou Wei <zou_wei@...wei.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
Powered by blists - more mailing lists