aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2012-04-04 15:01:43 -0400
committerEric Paris <eparis@redhat.com>2012-04-09 12:23:04 -0400
commit50c205f5e5c2e2af002fd4ef537ded79b90b1b56 (patch)
tree9965a7746aa8c5e982357d5b8c46850f3283206c /security
parent07f62eb66c6626aa5653a0fcb34c9c040d0bd032 (diff)
LSM: do not initialize common_audit_data to 0
It isn't needed. If you don't set the type of the data associated with that type it is a pretty obvious programming bug. So why waste the cycles? Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/capability.c2
-rw-r--r--security/apparmor/file.c2
-rw-r--r--security/apparmor/ipc.c2
-rw-r--r--security/apparmor/lib.c2
-rw-r--r--security/apparmor/lsm.c2
-rw-r--r--security/apparmor/policy.c2
-rw-r--r--security/apparmor/policy_unpack.c2
-rw-r--r--security/apparmor/resource.c2
-rw-r--r--security/selinux/avc.c2
-rw-r--r--security/selinux/hooks.c68
-rw-r--r--security/smack/smack.h2
11 files changed, 44 insertions, 44 deletions
diff --git a/security/apparmor/capability.c b/security/apparmor/capability.c
index b66a0e4a5693..887a5e948945 100644
--- a/security/apparmor/capability.c
+++ b/security/apparmor/capability.c
@@ -65,7 +65,7 @@ static int audit_caps(struct aa_profile *profile, struct task_struct *task,
65 int type = AUDIT_APPARMOR_AUTO; 65 int type = AUDIT_APPARMOR_AUTO;
66 struct common_audit_data sa; 66 struct common_audit_data sa;
67 struct apparmor_audit_data aad = {0,}; 67 struct apparmor_audit_data aad = {0,};
68 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_CAP); 68 sa.type = LSM_AUDIT_DATA_CAP;
69 sa.aad = &aad; 69 sa.aad = &aad;
70 sa.u.cap = cap; 70 sa.u.cap = cap;
71 sa.aad->tsk = task; 71 sa.aad->tsk = task;
diff --git a/security/apparmor/file.c b/security/apparmor/file.c
index 6ab264ca85cc..cf19d4093ca4 100644
--- a/security/apparmor/file.c
+++ b/security/apparmor/file.c
@@ -108,7 +108,7 @@ int aa_audit_file(struct aa_profile *profile, struct file_perms *perms,
108 int type = AUDIT_APPARMOR_AUTO; 108 int type = AUDIT_APPARMOR_AUTO;
109 struct common_audit_data sa; 109 struct common_audit_data sa;
110 struct apparmor_audit_data aad = {0,}; 110 struct apparmor_audit_data aad = {0,};
111 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 111 sa.type = LSM_AUDIT_DATA_NONE;
112 sa.aad = &aad; 112 sa.aad = &aad;
113 aad.op = op, 113 aad.op = op,
114 aad.fs.request = request; 114 aad.fs.request = request;
diff --git a/security/apparmor/ipc.c b/security/apparmor/ipc.c
index dba449b74db3..cf1071b14232 100644
--- a/security/apparmor/ipc.c
+++ b/security/apparmor/ipc.c
@@ -42,7 +42,7 @@ static int aa_audit_ptrace(struct aa_profile *profile,
42{ 42{
43 struct common_audit_data sa; 43 struct common_audit_data sa;
44 struct apparmor_audit_data aad = {0,}; 44 struct apparmor_audit_data aad = {0,};
45 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 45 sa.type = LSM_AUDIT_DATA_NONE;
46 sa.aad = &aad; 46 sa.aad = &aad;
47 aad.op = OP_PTRACE; 47 aad.op = OP_PTRACE;
48 aad.target = target; 48 aad.target = target;
diff --git a/security/apparmor/lib.c b/security/apparmor/lib.c
index b11a2652f541..7430298116d6 100644
--- a/security/apparmor/lib.c
+++ b/security/apparmor/lib.c
@@ -66,7 +66,7 @@ void aa_info_message(const char *str)
66 if (audit_enabled) { 66 if (audit_enabled) {
67 struct common_audit_data sa; 67 struct common_audit_data sa;
68 struct apparmor_audit_data aad = {0,}; 68 struct apparmor_audit_data aad = {0,};
69 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 69 sa.type = LSM_AUDIT_DATA_NONE;
70 sa.aad = &aad; 70 sa.aad = &aad;
71 aad.info = str; 71 aad.info = str;
72 aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, NULL); 72 aa_audit_msg(AUDIT_APPARMOR_STATUS, &sa, NULL);
diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c
index 4f7bc07b2dce..032daab449b0 100644
--- a/security/apparmor/lsm.c
+++ b/security/apparmor/lsm.c
@@ -589,7 +589,7 @@ static int apparmor_setprocattr(struct task_struct *task, char *name,
589 } else { 589 } else {
590 struct common_audit_data sa; 590 struct common_audit_data sa;
591 struct apparmor_audit_data aad = {0,}; 591 struct apparmor_audit_data aad = {0,};
592 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 592 sa.type = LSM_AUDIT_DATA_NONE;
593 sa.aad = &aad; 593 sa.aad = &aad;
594 aad.op = OP_SETPROCATTR; 594 aad.op = OP_SETPROCATTR;
595 aad.info = name; 595 aad.info = name;
diff --git a/security/apparmor/policy.c b/security/apparmor/policy.c
index 03dbaef2f8e3..421681c7c346 100644
--- a/security/apparmor/policy.c
+++ b/security/apparmor/policy.c
@@ -965,7 +965,7 @@ static int audit_policy(int op, gfp_t gfp, const char *name, const char *info,
965{ 965{
966 struct common_audit_data sa; 966 struct common_audit_data sa;
967 struct apparmor_audit_data aad = {0,}; 967 struct apparmor_audit_data aad = {0,};
968 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 968 sa.type = LSM_AUDIT_DATA_NONE;
969 sa.aad = &aad; 969 sa.aad = &aad;
970 aad.op = op; 970 aad.op = op;
971 aad.name = name; 971 aad.name = name;
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c
index 504ba4015aa2..329b1fd30749 100644
--- a/security/apparmor/policy_unpack.c
+++ b/security/apparmor/policy_unpack.c
@@ -95,7 +95,7 @@ static int audit_iface(struct aa_profile *new, const char *name,
95 struct aa_profile *profile = __aa_current_profile(); 95 struct aa_profile *profile = __aa_current_profile();
96 struct common_audit_data sa; 96 struct common_audit_data sa;
97 struct apparmor_audit_data aad = {0,}; 97 struct apparmor_audit_data aad = {0,};
98 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 98 sa.type = LSM_AUDIT_DATA_NONE;
99 sa.aad = &aad; 99 sa.aad = &aad;
100 if (e) 100 if (e)
101 aad.iface.pos = e->pos - e->start; 101 aad.iface.pos = e->pos - e->start;
diff --git a/security/apparmor/resource.c b/security/apparmor/resource.c
index d06f57b74f77..e1f3d7ef2c54 100644
--- a/security/apparmor/resource.c
+++ b/security/apparmor/resource.c
@@ -52,7 +52,7 @@ static int audit_resource(struct aa_profile *profile, unsigned int resource,
52 struct common_audit_data sa; 52 struct common_audit_data sa;
53 struct apparmor_audit_data aad = {0,}; 53 struct apparmor_audit_data aad = {0,};
54 54
55 COMMON_AUDIT_DATA_INIT(&sa, LSM_AUDIT_DATA_NONE); 55 sa.type = LSM_AUDIT_DATA_NONE;
56 sa.aad = &aad; 56 sa.aad = &aad;
57 aad.op = OP_SETRLIMIT, 57 aad.op = OP_SETRLIMIT,
58 aad.rlim.rlim = resource; 58 aad.rlim.rlim = resource;
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index c04eea2bdb0a..cd91e25667d1 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -469,7 +469,7 @@ noinline int slow_avc_audit(u32 ssid, u32 tsid, u16 tclass,
469 469
470 if (!a) { 470 if (!a) {
471 a = &stack_data; 471 a = &stack_data;
472 COMMON_AUDIT_DATA_INIT(a, LSM_AUDIT_DATA_NONE); 472 a->type = LSM_AUDIT_DATA_NONE;
473 a->selinux_audit_data = &sad; 473 a->selinux_audit_data = &sad;
474 } 474 }
475 475
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index d79762946c6e..d9fa2489a551 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1427,7 +1427,7 @@ static int cred_has_capability(const struct cred *cred,
1427 u32 av = CAP_TO_MASK(cap); 1427 u32 av = CAP_TO_MASK(cap);
1428 int rc; 1428 int rc;
1429 1429
1430 COMMON_AUDIT_DATA_INIT(&ad, LSM_AUDIT_DATA_CAP); 1430 ad.type = LSM_AUDIT_DATA_CAP;
1431 ad.selinux_audit_data = &sad; 1431 ad.selinux_audit_data = &sad;
1432 ad.u.cap = cap; 1432 ad.u.cap = cap;
1433 1433
@@ -1498,7 +1498,7 @@ static inline int dentry_has_perm(const struct cred *cred,
1498 struct common_audit_data ad; 1498 struct common_audit_data ad;
1499 struct selinux_audit_data sad = {0,}; 1499 struct selinux_audit_data sad = {0,};
1500 1500
1501 COMMON_AUDIT_DATA_INIT(&ad, LSM_AUDIT_DATA_DENTRY); 1501 ad.type = LSM_AUDIT_DATA_DENTRY;
1502 ad.u.dentry = dentry; 1502 ad.u.dentry = dentry;
1503 ad.selinux_audit_data = &sad; 1503 ad.selinux_audit_data = &sad;
1504 return inode_has_perm(cred, inode, av, &ad, 0); 1504 return inode_has_perm(cred, inode, av, &ad, 0);
@@ -1515,7 +1515,7 @@ static inline int path_has_perm(const struct cred *cred,
1515 struct common_audit_data ad; 1515 struct common_audit_data ad;
1516 struct selinux_audit_data sad = {0,}; 1516 struct selinux_audit_data sad = {0,};
1517 1517
1518 COMMON_AUDIT_DATA_INIT(&ad, LSM_AUDIT_DATA_PATH); 1518 ad.type = LSM_AUDIT_DATA_PATH;
1519 ad.u.path = *path; 1519 ad.u.path = *path;
1520 ad.selinux_audit_data = &sad; 1520 ad.selinux_audit_data = &sad;
1521 return inode_has_perm(cred, inode, av, &ad, 0); 1521 return inode_has_perm(cred, inode, av, &ad, 0);
@@ -1540,7 +1540,7 @@ static int file_has_perm(const struct cred *cred,
1540 u32 sid = cred_sid(cred); 1540 u32 sid = cred_sid(cred);
1541 int rc; 1541 int rc;
1542 1542
1543 COMMON_AUDIT_DATA_INIT(&ad, LSM_AUDIT_DATA_PATH); 1543 ad.type = LSM_AUDIT_DATA_PATH;
1544 ad.u.path = file->f_path; 1544 ad.u.path = file->f_path;
1545 ad.selinux_audit_data = &sad; 1545 ad.selinux_audit_data = &sad;
1546 1546
@@ -1581,7 +1581,7 @@ static int may_create(struct inode *dir,
1581 sid = tsec->sid; 1581 sid = tsec->sid;
1582 newsid = tsec->create_sid; 1582