From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932295AbdJJXRx (ORCPT ); Tue, 10 Oct 2017 19:17:53 -0400 Received: from sonic310-29.consmr.mail.ne1.yahoo.com ([66.163.186.210]:42811 "EHLO sonic310-29.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751837AbdJJXRv (ORCPT ); Tue, 10 Oct 2017 19:17:51 -0400 X-YMail-OSG: 90iNOVAVM1k.GZXVm5fFDqGO07AEX6RHJ0Pv1viI17VCun2Erq6AMN2sLUA2biN t0Z6Oq4eb9ViPh.8tKxreyA2FG.m37j5sJhwnEBgipyBInklqov3vIwtuDPgzhPkxfhKrkUXs3W1 Y9HIcGKvHH3DLj65aUEHzfr0t.N_Xsu.u1CQrgKGRop6h7hFIwGDIKZZ61resOQF42E3WosA5ryc eDPWfUNK7f0p8Ayl4WyB2yJkXm41g4hEDJnz0JT0FnN5vW_YASZMrJsJV.xl74e51eHHYvawr3JH Uq7XS3GWiZykfi.EE4MqDyw3A4iiHM5hFc7rL0ifOdqThagqp67nGftLVqjc0g7WsrLMtzQb4ngD zW3ihA8FmS9g2OySymnH6k7RdCC7pOTUWLW7B5Kv1wQKhYZLVO6BRk6Ig1LyCT88nTBRGVZrNnbA 7N6UXd8l1k3GPySvnwjQ77ACoBg2sJ4AZbJTm2IG0dhFUXwJeA8JitNRDq4_XHtAKfy6cuJhuVm. kKAUZOY5neF3_eJiqPSFFY9lTbuBuyiE3iuEQBtA- X-Yahoo-Newman-Id: 167131.71413.bm@smtp105.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 90iNOVAVM1k.GZXVm5fFDqGO07AEX6RHJ0Pv1viI17VCun2 Erq6AMN2sLUA2biNt0Z6Oq4eb9ViPh.8tKxreyA2FG.m37j5sJhwnEBgipyB Inklqov3vIwtuDPgzhPkxfhKrkUXs3W1Y9HIcGKvHH3DLj65aUEHzfr0t.N_ Xsu.u1CQrgKGRop6h7hFIwGDIKZZ61resOQF42E3WosA5ryceDPWfUNK7f0p 8Ayl4WyB2yJkXm41g4hEDJnz0JT0FnN5vW_YASZMrJsJV.xl74e51eHHYvaw r3JHUq7XS3GWiZykfi.EE4MqDyw3A4iiHM5hFc7rL0ifOdqThagqp67nGftL Vqjc0g7WsrLMtzQb4ngDzW3ihA8FmS9g2OySymnH6k7RdCC7pOTUWLW7B5Kv 1wQKhYZLVO6BRk6Ig1LyCT88nTBRGVZrNnbA7N6UXd8l1k3GPySvnwjQ77AC oBg2sJ4AZbJTm2IG0dhFUXwJeA8JitNRDq4_XHtAKfy6cuJhuVm.kKAUZOY5 neF3_eJiqPSFFY9lTbuBuyiE3iuEQBtA- X-Yahoo-SMTP: OIJXglSswBDfgLtXluJ6wiAYv6_cnw-- Subject: Re: [PATCH] selinux: Fix bool initialization/comparison To: Thomas Meyer , paul@paul-moore.com, sds@tycho.nsa.gov, eparis@parisplace.org, james.l.morris@oracle.com, serge@hallyn.com, selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org References: <1507383097081-778026979-0-diffsplit-thomas@m3y3r.de> <1507383097088-1068794175-19-diffsplit-thomas@m3y3r.de> From: Casey Schaufler Message-ID: <5d4bccdd-c1e9-f32a-2d3b-13fd13d2f5e6@schaufler-ca.com> Date: Tue, 10 Oct 2017 16:17:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1507383097088-1068794175-19-diffsplit-thomas@m3y3r.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/7/2017 7:02 AM, Thomas Meyer wrote: > Bool initializations should use true and false. Bool tests don't need > comparisons. > > Signed-off-by: Thomas Meyer > --- > > diff -u -p a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c > --- a/security/selinux/ss/mls.c > +++ b/security/selinux/ss/mls.c > @@ -550,7 +550,7 @@ int mls_compute_sid(struct context *scon > > /* Fallthrough */ > case AVTAB_CHANGE: > - if ((tclass == policydb.process_class) || (sock == true)) > + if ((tclass == policydb.process_class) || (sock)) bool tests don't need parentheses, either. + if ((tclass == policydb.process_class) || sock) > /* Use the process MLS attributes. */ > return mls_context_cpy(newcontext, scontext); > else > diff -u -p a/security/selinux/ss/services.c b/security/selinux/ss/services.c > --- a/security/selinux/ss/services.c > +++ b/security/selinux/ss/services.c > @@ -1656,7 +1656,7 @@ static int security_compute_sid(u32 ssid > } 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)) Likewise > newcontext.role = scontext->role; > else > newcontext.role = OBJECT_R_VAL; > @@ -1668,7 +1668,7 @@ static int security_compute_sid(u32 ssid > } 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)) { On more time. > /* Use the type of process. */ > newcontext.type = scontext->type; > } else { > -- > To unsubscribe from this list: send the line "unsubscribe linux-security-module" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > From mboxrd@z Thu Jan 1 00:00:00 1970 From: casey@schaufler-ca.com (Casey Schaufler) Date: Tue, 10 Oct 2017 16:17:45 -0700 Subject: [PATCH] selinux: Fix bool initialization/comparison In-Reply-To: <1507383097088-1068794175-19-diffsplit-thomas@m3y3r.de> References: <1507383097081-778026979-0-diffsplit-thomas@m3y3r.de> <1507383097088-1068794175-19-diffsplit-thomas@m3y3r.de> Message-ID: <5d4bccdd-c1e9-f32a-2d3b-13fd13d2f5e6@schaufler-ca.com> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org On 10/7/2017 7:02 AM, Thomas Meyer wrote: > Bool initializations should use true and false. Bool tests don't need > comparisons. > > Signed-off-by: Thomas Meyer > --- > > diff -u -p a/security/selinux/ss/mls.c b/security/selinux/ss/mls.c > --- a/security/selinux/ss/mls.c > +++ b/security/selinux/ss/mls.c > @@ -550,7 +550,7 @@ int mls_compute_sid(struct context *scon > > /* Fallthrough */ > case AVTAB_CHANGE: > - if ((tclass == policydb.process_class) || (sock == true)) > + if ((tclass == policydb.process_class) || (sock)) bool tests don't need parentheses, either. + if ((tclass == policydb.process_class) || sock) > /* Use the process MLS attributes. */ > return mls_context_cpy(newcontext, scontext); > else > diff -u -p a/security/selinux/ss/services.c b/security/selinux/ss/services.c > --- a/security/selinux/ss/services.c > +++ b/security/selinux/ss/services.c > @@ -1656,7 +1656,7 @@ static int security_compute_sid(u32 ssid > } 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)) Likewise > newcontext.role = scontext->role; > else > newcontext.role = OBJECT_R_VAL; > @@ -1668,7 +1668,7 @@ static int security_compute_sid(u32 ssid > } 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)) { On more time. > /* Use the type of process. */ > newcontext.type = scontext->type; > } else { > -- > To unsubscribe from this list: send the line "unsubscribe linux-security-module" in > the body of a message to majordomo at vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html