diff options
author | John Johansen <john.johansen@canonical.com> | 2025-02-17 01:46:37 -0800 |
---|---|---|
committer | John Johansen <john.johansen@canonical.com> | 2025-07-20 02:31:06 -0700 |
commit | 9afdc6abb007d5a86f54e9f10870ac1468155ca5 (patch) | |
tree | ca4322b73a8c95da56d8e0866ef2c490791ffdd1 /security/apparmor/policy_unpack.c | |
parent | f9c9dce01e9640d94a37304bddc97b738ee4ac35 (diff) |
apparmor: transition from a list of rules to a vector of rules
The set of rules on a profile is not dynamically extended, instead
if a new ruleset is needed a new version of the profile is created.
This allows us to use a vector of rules instead of a list, slightly
reducing memory usage and simplifying the code.
Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/policy_unpack.c')
-rw-r--r-- | security/apparmor/policy_unpack.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 58c106b63727..553e52df3aa9 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -885,7 +885,7 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name) error = -ENOMEM; goto fail; } - rules = list_first_entry(&profile->rules, typeof(*rules), list); + rules = profile->label.rules[0]; /* profile renaming is optional */ (void) aa_unpack_str(e, &profile->rename, "rename"); @@ -1285,8 +1285,8 @@ static bool verify_perms(struct aa_policydb *pdb) */ static int verify_profile(struct aa_profile *profile) { - struct aa_ruleset *rules = list_first_entry(&profile->rules, - typeof(*rules), list); + struct aa_ruleset *rules = profile->label.rules[0]; + if (!rules) return 0; |