Skip to content

Commit 592b24c

Browse files
tyhicksmimizohar
authored andcommitted
ima: Use the common function to detect LSM conditionals in a rule
Make broader use of ima_rule_contains_lsm_cond() to check if a given rule contains an LSM conditional. This is a code cleanup and has no user-facing change. Signed-off-by: Tyler Hicks <[email protected]> Reviewed-by: Mimi Zohar <[email protected]> Signed-off-by: Mimi Zohar <[email protected]>
1 parent 30031b0 commit 592b24c

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

security/integrity/ima/ima_policy.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -360,17 +360,10 @@ static bool ima_rule_contains_lsm_cond(struct ima_rule_entry *entry)
360360
static void ima_lsm_update_rules(void)
361361
{
362362
struct ima_rule_entry *entry, *e;
363-
int i, result, needs_update;
363+
int result;
364364

365365
list_for_each_entry_safe(entry, e, &ima_policy_rules, list) {
366-
needs_update = 0;
367-
for (i = 0; i < MAX_LSM_RULES; i++) {
368-
if (entry->lsm[i].args_p) {
369-
needs_update = 1;
370-
break;
371-
}
372-
}
373-
if (!needs_update)
366+
if (!ima_rule_contains_lsm_cond(entry))
374367
continue;
375368

376369
result = ima_lsm_update_rule(entry);

0 commit comments

Comments
 (0)