]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - security/apparmor/policy_unpack.c
apparmor: change aad apparmor_audit_data macro to a fn macro
[mirror_ubuntu-bionic-kernel.git] / security / apparmor / policy_unpack.c
index 38c148f33fa4d04686633a25ac6deccd8efe95e6..441efc965f2b605750acf148d3000f1ddf775d50 100644 (file)
@@ -79,13 +79,17 @@ struct aa_ext {
 static void audit_cb(struct audit_buffer *ab, void *va)
 {
        struct common_audit_data *sa = va;
-       if (sa->aad->iface.target) {
-               struct aa_profile *name = sa->aad->iface.target;
+
+       if (aad(sa)->iface.ns) {
+               audit_log_format(ab, " ns=");
+               audit_log_untrustedstring(ab, aad(sa)->iface.ns);
+       }
+       if (aad(sa)->iface.name) {
                audit_log_format(ab, " name=");
-               audit_log_untrustedstring(ab, name->base.hname);
+               audit_log_untrustedstring(ab, aad(sa)->iface.name);
        }
-       if (sa->aad->iface.pos)
-               audit_log_format(ab, " offset=%ld", sa->aad->iface.pos);
+       if (aad(sa)->iface.pos)
+               audit_log_format(ab, " offset=%ld", aad(sa)->iface.pos);
 }
 
 /**
@@ -104,20 +108,18 @@ static int audit_iface(struct aa_profile *new, const char *ns_name,
                       int error)
 {
        struct aa_profile *profile = __aa_current_profile();
-       struct common_audit_data sa;
-       struct apparmor_audit_data aad = {0,};
-       sa.type = LSM_AUDIT_DATA_NONE;
-       sa.aad = &aad;
-       aad.iface.ns = ns_name;
+       DEFINE_AUDIT_DATA(sa, LSM_AUDIT_DATA_NONE, NULL);
        if (e)
-               aad.iface.pos = e->pos - e->start;
-       aad.iface.target = new;
-       aad.name = name;
-       aad.info = info;
-       aad.error = error;
-
-       return aa_audit(AUDIT_APPARMOR_STATUS, profile, GFP_KERNEL, &sa,
-                       audit_cb);
+               aad(&sa)->iface.pos = e->pos - e->start;
+       aad(&sa)->iface.ns = ns_name;
+       if (new)
+               aad(&sa)->iface.name = new->base.hname;
+       else
+               aad(&sa)->iface.name = name;
+       aad(&sa)->info = info;
+       aad(&sa)->error = error;
+
+       return aa_audit(AUDIT_APPARMOR_STATUS, profile, &sa, audit_cb);
 }
 
 void aa_loaddata_kref(struct kref *kref)