summaryrefslogtreecommitdiffstats
path: root/security/apparmor/policy.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2022-09-14 09:20:12 +0200
committerJohn Johansen <john.johansen@canonical.com>2023-10-19 00:30:29 +0200
commitbd7bd201ca46c211c3ab251ca9854787d1331a2f (patch)
tree4b7abdb8932549682082d9bf01c75c80d8f0e0de /security/apparmor/policy.c
parentapparmor: rename SK_CTX() to aa_sock and make it an inline fn (diff)
downloadlinux-bd7bd201ca46c211c3ab251ca9854787d1331a2f.tar.xz
linux-bd7bd201ca46c211c3ab251ca9854787d1331a2f.zip
apparmor: combine common_audit_data and apparmor_audit_data
Everywhere where common_audit_data is used apparmor audit_data is also used. We can simplify the code and drop the use of the aad macro everywhere by combining the two structures. Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/policy.c')
-rw-r--r--security/apparmor/policy.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index d7525f228c43..4e26c97f1396 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -723,10 +723,11 @@ static int replacement_allowed(struct aa_profile *profile, int noreplace,
static void audit_cb(struct audit_buffer *ab, void *va)
{
struct common_audit_data *sa = va;
+ struct apparmor_audit_data *ad = aad(sa);
- if (aad(sa)->iface.ns) {
+ if (ad->iface.ns) {
audit_log_format(ab, " ns=");
- audit_log_untrustedstring(ab, aad(sa)->iface.ns);
+ audit_log_untrustedstring(ab, ad->iface.ns);
}
}
@@ -745,15 +746,15 @@ static int audit_policy(struct aa_label *label, const char *op,
const char *ns_name, const char *name,
const char *info, int error)
{
- DEFINE_AUDIT_DATA(sa, LSM_AUDIT_DATA_NONE, AA_CLASS_NONE, op);
+ DEFINE_AUDIT_DATA(ad, LSM_AUDIT_DATA_NONE, AA_CLASS_NONE, op);
- aad(&sa)->iface.ns = ns_name;
- aad(&sa)->name = name;
- aad(&sa)->info = info;
- aad(&sa)->error = error;
- aad(&sa)->label = label;
+ ad.iface.ns = ns_name;
+ ad.name = name;
+ ad.info = info;
+ ad.error = error;
+ ad.label = label;
- aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, audit_cb);
+ aa_audit_msg(AUDIT_APPARMOR_STATUS, &ad, audit_cb);
return error;
}