Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp579681ybz; Wed, 15 Apr 2020 14:27:21 -0700 (PDT) X-Google-Smtp-Source: APiQypJ+LU6LvSkV145Z+jQSzDp4dgHGHrY3xLEOFuFm3aLM1eA6IkSJ2dWhNREKPm2omlVdeuoA X-Received: by 2002:aa7:c2d8:: with SMTP id m24mr5017209edp.342.1586986041255; Wed, 15 Apr 2020 14:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586986041; cv=none; d=google.com; s=arc-20160816; b=o6lIkOgX/Ee+Supwu6rxkh5q9yNzPfYyk8tOFtHAbAWN42qiDSc6PraiP15P05cvZ1 1TEIR6DO36yDW990cUWdrKsSeR/CSVt21Qr1tEbgs+jj3TlKBGzH/Xyr/mzwaC3fZjkA x1bUcxALPyP/988PN5tvXpfzxFxnW0EnNeYVh8J0m8iZfDk62ApXubcI4iFJcw5HJx7f 4Y2mrSD4i+xXe2Qf6pKbQk3uBdTTVQybn8pRYbFTDEnDppGO5uru94rMu/cZi8DEcd3Z 8rv1EtuKg/5mACc6sst/wIxxlWoVixKb7t7Wn3vIg797lSqxNOscya6dIvQmm36W5t5a 2xPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=sELCCCAImq2LLfXwN60mzGc+nRIl2IMtjTbe3yj1K68=; b=Mn9CxTItQu2Ta5DpY/zC3QEMYH773uAtQx8bSNakz2NkcdFqL36MC9pdzsZlCV+PD6 o8g9XyvnYjI3Ga+ZXIDKgd7t22TLGYbYA9SE/x8FzgExZzmzvetMNIq7YYbt36XasfFS FnTLef0vcahfAXnYKfdn2g1GsXPvclvKNdsB6AOvxXrdoKNdmUDH5rTKBLaxI4/7JB5f LzrHUjNjlA9ElfU2pACAEINHnMKfvXpmKmztH3BxUus0HF0WcPVLA0HDQy7cfZzP+19w Btw6VF4IHC/1FjAlMPUBunHDXSHRDN+5H+q14z8vK2J5aG60o+/TIfuv5lItKDWRkLG7 prVg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si10822855eds.587.2020.04.15.14.26.57; Wed, 15 Apr 2020 14:27:21 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439605AbgDNLtQ (ORCPT + 99 others); Tue, 14 Apr 2020 07:49:16 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:37041 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728426AbgDNLtM (ORCPT ); Tue, 14 Apr 2020 07:49:12 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R801e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0TvWiAKo_1586864932; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0TvWiAKo_1586864932) by smtp.aliyun-inc.com(127.0.0.1); Tue, 14 Apr 2020 19:48:52 +0800 From: Tianjia Zhang To: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, jmorris@namei.org, serge@hallyn.com, zhangliguang@linux.alibaba.com, zhang.jia@linux.alibaba.com Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, tianjia.zhang@linux.alibaba.com Subject: [PATCH 2/2] ima: simplify function process_buffer_measurement Date: Tue, 14 Apr 2020 19:48:50 +0800 Message-Id: <20200414114850.98622-3-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200414114850.98622-1-tianjia.zhang@linux.alibaba.com> References: <20200414114850.98622-1-tianjia.zhang@linux.alibaba.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove duplicate judgment code to make it more suitable for linux code style. Signed-off-by: Tianjia Zhang --- security/integrity/ima/ima_main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index 9d0abedeae77..55cbbe97ce6e 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c @@ -750,15 +750,15 @@ void process_buffer_measurement(const void *buf, int size, goto out; ret = ima_store_template(entry, violation, NULL, buf, pcr); - - if (ret < 0) - ima_free_template_entry(entry); - -out: if (ret < 0) - pr_devel("%s: failed, result: %d\n", __func__, ret); + goto out_free_entry; return; + +out_free_entry: + ima_free_template_entry(entry); +out: + pr_devel("%s: failed, result: %d\n", __func__, ret); } /** -- 2.17.1