[PATCH 2/2] ima: simplify function process_buffer_measurement

Tianjia Zhang tianjia.zhang at linux.alibaba.com
Tue Apr 14 11:48:50 UTC 2020


Remove duplicate judgment code to make it more suitable for linux
code style.

Signed-off-by: Tianjia Zhang <tianjia.zhang at linux.alibaba.com>
---
 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



More information about the Linux-security-module-archive mailing list