Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp424420ybz; Wed, 15 Apr 2020 11:19:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJTx0tzNUUio2ynpHWXfStvZygWpCOhkA4cwedzAhMYtiImFxULFIoOqreyIRN55l8QRt17 X-Received: by 2002:a17:906:a39a:: with SMTP id k26mr6002158ejz.172.1586974753338; Wed, 15 Apr 2020 11:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586974753; cv=none; d=google.com; s=arc-20160816; b=Y0Inw+i92t1KnlP7zKgTlEB1vSajrDbIOFOyaI8qC9l5lilupAyib0rZqqzO5PmIWX 4rf09aPzfnbrSYFQmj6wK7z5Bi6LFOyI8bbJ6ffVlPsed1cxPa4bkn4+B2uphfKnCioZ SlpA1VR8p6fBLfHSl9nwYwcvn7zat8m0Rj83nMGymLRfgwQiDesGH+ZTgOhcp8aj5pSN aOCBMut7JZpqfkViBTy5/0U4k930SRAoKI/SmEVLKUDP/lXHPgjiUVR9Qsu4/Mj3CPjm 44ECmWFlW3Qe3Sdcf3lVrHEh4bY5ukEd5KU0zuGq9nqNqqTpVnaxX82dYJwUFxvo5yQr /ffg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=aQ4nXUX69fmGaK7cE5YJShEEX57Php/ZM5ZazcUpd58=; b=HAAqyZQsKCiA1qXuWO9T9zb4xb4YEzj1FhTJZoiCDbDCbTuS3172OwieyCgt451d67 RKW6bLd+clMp+npyfjQ810AZUpvBYgg3RnDJK1JDYL3iNldzkCZVDF3jx89oMsTrrImG 2GDjzxFvsZHnNgRnLWE3XWpmrok2d2hnpgsWNWC76sDLMHSuPrUkkzNvR62o+4gaKsbY 8zZ5Q4qDOtN7gITWEwWm9LhW0xPAOX0tF+TqMDRXrELooYJoNsaCmlAn0ymGD/eN5bqQ kVqQWoPpHjrc9SviQ1MQDKmI5GfQ7C8OLZxDTqVappCCTTkRpmXBpD7L37g9Z6qUASrH b/xQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id op2si11519393ejb.395.2020.04.15.11.18.48; Wed, 15 Apr 2020 11:19:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407046AbgDNIMA (ORCPT + 99 others); Tue, 14 Apr 2020 04:12:00 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:35926 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2407026AbgDNIL4 (ORCPT ); Tue, 14 Apr 2020 04:11:56 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id D2AD1250E5F5107F30E6; Tue, 14 Apr 2020 16:11:52 +0800 (CST) Received: from linux-lmwb.huawei.com (10.175.103.112) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.487.0; Tue, 14 Apr 2020 16:11:45 +0800 From: Zou Wei To: , , , , CC: Zou Wei Subject: [PATCH -next] selinux: fix warning Comparison to bool Date: Tue, 14 Apr 2020 16:18:07 +0800 Message-ID: <1586852287-67588-1-git-send-email-zou_wei@huawei.com> X-Mailer: git-send-email 2.6.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.103.112] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Zou Wei --- 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