summaryrefslogtreecommitdiffstats
path: root/security/apparmor/resource.c
diff options
context:
space:
mode:
authorJohn Johansen <john.johansen@canonical.com>2017-01-16 00:43:02 -0800
committerJohn Johansen <john.johansen@canonical.com>2017-01-16 01:18:47 -0800
commitef88a7ac55fdd3bf6ac3942b83aa29311b45339b (patch)
tree54c6b15e2101650dd169caf745bdb17521db899c /security/apparmor/resource.c
parent47f6e5cc7355e4ff2fd7ace919aa9e291077c26b (diff)
downloadop-kernel-dev-ef88a7ac55fdd3bf6ac3942b83aa29311b45339b.zip
op-kernel-dev-ef88a7ac55fdd3bf6ac3942b83aa29311b45339b.tar.gz
apparmor: change aad apparmor_audit_data macro to a fn macro
The aad macro can replace aad strings when it is not intended to. Switch to a fn macro so it is only applied when intended. Also at the same time cleanup audit_data initialization by putting common boiler plate behind a macro, and dropping the gfp_t parameter which will become useless. Signed-off-by: John Johansen <john.johansen@canonical.com>
Diffstat (limited to 'security/apparmor/resource.c')
-rw-r--r--security/apparmor/resource.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/security/apparmor/resource.c b/security/apparmor/resource.c
index 67a6072..86a941a 100644
--- a/security/apparmor/resource.c
+++ b/security/apparmor/resource.c
@@ -35,7 +35,7 @@ static void audit_cb(struct audit_buffer *ab, void *va)
struct common_audit_data *sa = va;
audit_log_format(ab, " rlimit=%s value=%lu",
- rlim_names[sa->aad->rlim.rlim], sa->aad->rlim.max);
+ rlim_names[aad(sa)->rlim.rlim], aad(sa)->rlim.max);
}
/**
@@ -50,17 +50,12 @@ static void audit_cb(struct audit_buffer *ab, void *va)
static int audit_resource(struct aa_profile *profile, unsigned int resource,
unsigned long value, int error)
{
- struct common_audit_data sa;
- struct apparmor_audit_data aad = {0,};
-
- sa.type = LSM_AUDIT_DATA_NONE;
- sa.aad = &aad;
- aad.op = OP_SETRLIMIT,
- aad.rlim.rlim = resource;
- aad.rlim.max = value;
- aad.error = error;
- return aa_audit(AUDIT_APPARMOR_AUTO, profile, GFP_KERNEL, &sa,
- audit_cb);
+ DEFINE_AUDIT_DATA(sa, LSM_AUDIT_DATA_NONE, OP_SETRLIMIT);
+
+ aad(&sa)->rlim.rlim = resource;
+ aad(&sa)->rlim.max = value;
+ aad(&sa)->error = error;
+ return aa_audit(AUDIT_APPARMOR_AUTO, profile, &sa, audit_cb);
}
/**
OpenPOWER on IntegriCloud