From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0545C433E0 for ; Fri, 19 Jun 2020 16:00:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A2218207FC for ; Fri, 19 Jun 2020 16:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592582426; bh=Oa8kc7cRgdo9eCRG+fgo9yyyrMRD8k/JO06reJGziy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sBBD519Evy6r3Zp+S2wlw5aMWF26xOfEjAMQQTTuMYScBPzILt7au6oVvQxo8+27c koINhlQvhIZIBnrCIsIb3ytYTVpf8E439jM/cF4YfHcrJhoANJMtzf9ksotYXxPNkZ v870990jM9KH9ZxSkOl373A9MgERaXAxR6MueFN8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394111AbgFSQAY (ORCPT ); Fri, 19 Jun 2020 12:00:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:45184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390120AbgFSPOe (ORCPT ); Fri, 19 Jun 2020 11:14:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8E639218AC; Fri, 19 Jun 2020 15:14:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592579674; bh=Oa8kc7cRgdo9eCRG+fgo9yyyrMRD8k/JO06reJGziy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCP3/zgM42iNOCYImvmbuogJY16tbBkfLFqTMd9/+lSGe1OEX36E+p95hbKPoKrmj HvxERCaBOzPW+zbCdM+EGiNUtsAtejn+jy1N6KpowpN1rVfabfNZLV0I1vGqt+lTuM qbiMK3b2fW0RjPC3Czv6zRbYx38GimReGIhO171Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Struczynski , Mimi Zohar , Sasha Levin Subject: [PATCH 5.4 193/261] ima: Remove redundant policy rule set in add_rules() Date: Fri, 19 Jun 2020 16:33:24 +0200 Message-Id: <20200619141659.149717605@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141649.878808811@linuxfoundation.org> References: <20200619141649.878808811@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Krzysztof Struczynski [ Upstream commit 6ee28442a465ab4c4be45e3b15015af24b1ba906 ] 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 Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin --- 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 99d357e84ee9..86624b1331ef 100644 --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -590,11 +590,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.25.1