Commit 1a9430db authored by Mimi Zohar's avatar Mimi Zohar Committed by Linus Torvalds

ima: cleanup the match_token policy code

Start the policy_tokens and the associated enumeration from zero,
simplifying the pt macro.
Signed-off-by: default avatarMimi Zohar <zohar@linux.ibm.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 94c13f66
...@@ -580,9 +580,9 @@ void ima_update_policy(void) ...@@ -580,9 +580,9 @@ void ima_update_policy(void)
ima_update_policy_flag(); ima_update_policy_flag();
} }
/* Keep the enumeration in sync with the policy_tokens! */
enum { enum {
Opt_err = -1, Opt_measure, Opt_dont_measure,
Opt_measure = 1, Opt_dont_measure,
Opt_appraise, Opt_dont_appraise, Opt_appraise, Opt_dont_appraise,
Opt_audit, Opt_hash, Opt_dont_hash, Opt_audit, Opt_hash, Opt_dont_hash,
Opt_obj_user, Opt_obj_role, Opt_obj_type, Opt_obj_user, Opt_obj_role, Opt_obj_type,
...@@ -592,10 +592,10 @@ enum { ...@@ -592,10 +592,10 @@ enum {
Opt_uid_gt, Opt_euid_gt, Opt_fowner_gt, Opt_uid_gt, Opt_euid_gt, Opt_fowner_gt,
Opt_uid_lt, Opt_euid_lt, Opt_fowner_lt, Opt_uid_lt, Opt_euid_lt, Opt_fowner_lt,
Opt_appraise_type, Opt_permit_directio, Opt_appraise_type, Opt_permit_directio,
Opt_pcr Opt_pcr, Opt_err
}; };
static match_table_t policy_tokens = { static const match_table_t policy_tokens = {
{Opt_measure, "measure"}, {Opt_measure, "measure"},
{Opt_dont_measure, "dont_measure"}, {Opt_dont_measure, "dont_measure"},
{Opt_appraise, "appraise"}, {Opt_appraise, "appraise"},
...@@ -1103,7 +1103,7 @@ void ima_policy_stop(struct seq_file *m, void *v) ...@@ -1103,7 +1103,7 @@ void ima_policy_stop(struct seq_file *m, void *v)
{ {
} }
#define pt(token) policy_tokens[token + Opt_err].pattern #define pt(token) policy_tokens[token].pattern
#define mt(token) mask_tokens[token] #define mt(token) mask_tokens[token]
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment