Skip to content

Commit 4b85039

Browse files
SamuelZOUpcmoore
authored andcommitted
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 <[email protected]> Signed-off-by: Zou Wei <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 8f3d9f3 commit 4b85039

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

security/selinux/ss/mls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ int mls_compute_sid(struct policydb *p,
536536

537537
/* Fallthrough */
538538
case AVTAB_CHANGE:
539-
if ((tclass == p->process_class) || (sock == true))
539+
if ((tclass == p->process_class) || sock)
540540
/* Use the process MLS attributes. */
541541
return mls_context_cpy(newcontext, scontext);
542542
else

security/selinux/ss/services.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1812,7 +1812,7 @@ static int security_compute_sid(struct selinux_state *state,
18121812
} else if (cladatum && cladatum->default_role == DEFAULT_TARGET) {
18131813
newcontext.role = tcontext->role;
18141814
} else {
1815-
if ((tclass == policydb->process_class) || (sock == true))
1815+
if ((tclass == policydb->process_class) || sock)
18161816
newcontext.role = scontext->role;
18171817
else
18181818
newcontext.role = OBJECT_R_VAL;
@@ -1824,7 +1824,7 @@ static int security_compute_sid(struct selinux_state *state,
18241824
} else if (cladatum && cladatum->default_type == DEFAULT_TARGET) {
18251825
newcontext.type = tcontext->type;
18261826
} else {
1827-
if ((tclass == policydb->process_class) || (sock == true)) {
1827+
if ((tclass == policydb->process_class) || sock) {
18281828
/* Use the type of process. */
18291829
newcontext.type = scontext->type;
18301830
} else {

0 commit comments

Comments
 (0)