Skip to content

Commit

Permalink
selinux: fix warning Comparison to bool
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
Zou Wei authored and Paul Moore committed Apr 14, 2020
1 parent 8f3d9f3 commit 4b85039
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion security/selinux/ss/mls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions security/selinux/ss/services.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down

0 comments on commit 4b85039

Please sign in to comment.