Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2732612ybz; Mon, 27 Apr 2020 03:33:45 -0700 (PDT) X-Google-Smtp-Source: APiQypKSDeotRVPTQdDg7AHeOElbnCIIPCtDHID4kkCy+oi+Ailr/WKcyKw5/Y225uTQRe3fchLG X-Received: by 2002:a50:f005:: with SMTP id r5mr16705082edl.376.1587983624972; Mon, 27 Apr 2020 03:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587983624; cv=none; d=google.com; s=arc-20160816; b=m+Fk8Twr8P+P2npqOyF0yPypn1TNcVBUUPUhpQFZDUBZ2F8XhGQ8GrzHKjzpiY5V1M HtQsRGoy1pDG+FhNtEteily4CFKzmTsVFW4PY3/0ATEhL7xKjM6mSPPn56AokYBSVXzB Qhq2nTU5bxWqe8SM0BYk2TSPVvSL0q5zEna6d7cOP41IqM5iv5+a5PVvXgpGF+H/aS5L 9Yo8DUyWpUporEM3trU8ZnGExYwww6b8oUPlgvD8gEJMvF0qYXdWE+GBzmUNgNXi1Kb0 IBe9iIHh47QRR3ibSYAJ0TDjd0jJ1FSroy0IA3HNin5oGM4KV+YVjVZDkWk+4F2v3+Z3 3M0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=000hIK6z4o6PLdV0RN/0LTETokczkFV23ld112Tsn6o=; b=bywrgXkxWrXYgjq4NKh6+MhIzK2ikyqrcwJH95I409Nv4teBxjSV+Wa12K1r66GQ3M DRuv4uttLJDCfFXxs88qns9baPNXUSZKWP0yMMK48yQirbj7guye+3N3THR8e4Wd8jAh Nv5petNfyodVO6hNF6cw+ejeEioMR9mbHDhmhDJJHAra4+ll+zU2+R1NCditXDaenYpw 75WuWyAr/CGShuLDcCNIywmnLB9a4ZoNbI42Fst9RwDkSwxbjD0RcsR5aMLsX2cKQsfP bovTHUr0vW3A9dWvwC3NTUo8soYmhwhRi15mkF4hPWAwiVMZcRVmPgoihp5JicxiURMV inVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: 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 q18si8040955edg.149.2020.04.27.03.33.22; Mon, 27 Apr 2020 03:33:44 -0700 (PDT) Received-SPF: pass (google.com: 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: 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 S1727106AbgD0Kbp (ORCPT + 99 others); Mon, 27 Apr 2020 06:31:45 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2108 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726537AbgD0Kbn (ORCPT ); Mon, 27 Apr 2020 06:31:43 -0400 Received: from lhreml725-chm.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 459A0124F449A199D767; Mon, 27 Apr 2020 11:31:42 +0100 (IST) Received: from fraeml714-chm.china.huawei.com (10.206.15.33) by lhreml725-chm.china.huawei.com (10.201.108.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 27 Apr 2020 11:31:42 +0100 Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.160) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Mon, 27 Apr 2020 12:31:41 +0200 From: Roberto Sassu To: , CC: , , , , Subject: [PATCH v2 4/6] ima: Remove redundant policy rule set in add_rules() Date: Mon, 27 Apr 2020 12:28:58 +0200 Message-ID: <20200427102900.18887-4-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200427102900.18887-1-roberto.sassu@huawei.com> References: <20200427102900.18887-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.204.65.160] X-ClientProxiedBy: lhreml710-chm.china.huawei.com (10.201.108.61) To fraeml714-chm.china.huawei.com (10.206.15.33) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Struczynski Function ima_appraise_flag() returns the flag to be set in temp_ima_appraise depending on the hook identifier passed as an argument. It is not necessary to set the flag again for the POLICY_CHECK hook. Signed-off-by: Krzysztof Struczynski --- security/integrity/ima/ima_policy.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c index c334e0dc6083..ea9b991f0232 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -643,11 +643,8 @@ static void add_rules(struct ima_rule_entry *entries, int count, list_add_tail(&entry->list, &ima_policy_rules); } - if (entries[i].action == APPRAISE) { + if (entries[i].action == APPRAISE) temp_ima_appraise |= ima_appraise_flag(entries[i].func); - if (entries[i].func == POLICY_CHECK) - temp_ima_appraise |= IMA_APPRAISE_POLICY; - } } } -- 2.17.1