ima: cleanup ima_init_policy() a little
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 7 Apr 2015 09:22:11 +0000 (12:22 +0300)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Wed, 13 May 2015 10:07:19 +0000 (06:07 -0400)
It's a bit easier to read this if we split it up into two for loops.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
security/integrity/ima/ima_policy.c

index d1eefb9d65fb2bb457c280103ed9913fc4ade255..e86b58d459e6cf468f9bc4f970d9f1a4ae76876d 100644 (file)
@@ -338,16 +338,12 @@ void __init ima_init_policy(void)
        appraise_entries = ima_use_appraise_tcb ?
                         ARRAY_SIZE(default_appraise_rules) : 0;
 
-       for (i = 0; i < measure_entries + appraise_entries; i++) {
-               if (i < measure_entries)
-                       list_add_tail(&default_rules[i].list,
-                                     &ima_default_rules);
-               else {
-                       int j = i - measure_entries;
-
-                       list_add_tail(&default_appraise_rules[j].list,
-                                     &ima_default_rules);
-               }
+       for (i = 0; i < measure_entries; i++)
+               list_add_tail(&default_rules[i].list, &ima_default_rules);
+
+       for (i = 0; i < appraise_entries; i++) {
+               list_add_tail(&default_appraise_rules[i].list,
+                             &ima_default_rules);
        }
 
        ima_rules = &ima_default_rules;