[PATCH 2/2] ima: simplify function process_buffer_measurement
From: Tianjia Zhang
Date: Tue Apr 14 2020 - 07:49:22 EST
Remove duplicate judgment code to make it more suitable for linux
code style.
Signed-off-by: Tianjia Zhang <tianjia.zhang@xxxxxxxxxxxxxxxxx>
---
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