Skip to content

Commit 1a9430d

Browse files
mimizohartorvalds
authored andcommitted
ima: cleanup the match_token policy code
Start the policy_tokens and the associated enumeration from zero, simplifying the pt macro. Signed-off-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 94c13f6 commit 1a9430d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

security/integrity/ima/ima_policy.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,9 @@ void ima_update_policy(void)
580580
ima_update_policy_flag();
581581
}
582582

583+
/* Keep the enumeration in sync with the policy_tokens! */
583584
enum {
584-
Opt_err = -1,
585-
Opt_measure = 1, Opt_dont_measure,
585+
Opt_measure, Opt_dont_measure,
586586
Opt_appraise, Opt_dont_appraise,
587587
Opt_audit, Opt_hash, Opt_dont_hash,
588588
Opt_obj_user, Opt_obj_role, Opt_obj_type,
@@ -592,10 +592,10 @@ enum {
592592
Opt_uid_gt, Opt_euid_gt, Opt_fowner_gt,
593593
Opt_uid_lt, Opt_euid_lt, Opt_fowner_lt,
594594
Opt_appraise_type, Opt_permit_directio,
595-
Opt_pcr
595+
Opt_pcr, Opt_err
596596
};
597597

598-
static match_table_t policy_tokens = {
598+
static const match_table_t policy_tokens = {
599599
{Opt_measure, "measure"},
600600
{Opt_dont_measure, "dont_measure"},
601601
{Opt_appraise, "appraise"},
@@ -1103,7 +1103,7 @@ void ima_policy_stop(struct seq_file *m, void *v)
11031103
{
11041104
}
11051105

1106-
#define pt(token) policy_tokens[token + Opt_err].pattern
1106+
#define pt(token) policy_tokens[token].pattern
11071107
#define mt(token) mask_tokens[token]
11081108

11091109
/*

0 commit comments

Comments
 (0)