aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/inode.c4
-rw-r--r--security/keys/proc.c4
-rw-r--r--security/selinux/avc.c3
-rw-r--r--security/selinux/hooks.c5
-rw-r--r--security/selinux/selinuxfs.c26
-rw-r--r--security/selinux/ss/avtab.c3
6 files changed, 21 insertions, 24 deletions
diff --git a/security/inode.c b/security/inode.c
index 9b16e14f3a..d7ecf89fbc 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -50,7 +50,7 @@ static int default_open(struct inode *inode, struct file *file)
50 return 0; 50 return 0;
51} 51}
52 52
53static struct file_operations default_file_ops = { 53static const struct file_operations default_file_ops = {
54 .read = default_read_file, 54 .read = default_read_file,
55 .write = default_write_file, 55 .write = default_write_file,
56 .open = default_open, 56 .open = default_open,
@@ -215,7 +215,7 @@ static int create_by_name(const char *name, mode_t mode,
215 */ 215 */
216struct dentry *securityfs_create_file(const char *name, mode_t mode, 216struct dentry *securityfs_create_file(const char *name, mode_t mode,
217 struct dentry *parent, void *data, 217 struct dentry *parent, void *data,
218 struct file_operations *fops) 218 const struct file_operations *fops)
219{ 219{
220 struct dentry *dentry = NULL; 220 struct dentry *dentry = NULL;
221 int error; 221 int error;
diff --git a/security/keys/proc.c b/security/keys/proc.c
index 686a9ee0c5..3e0d0a6e22 100644
--- a/security/keys/proc.c
+++ b/security/keys/proc.c
@@ -33,7 +33,7 @@ static struct seq_operations proc_keys_ops = {
33 .show = proc_keys_show, 33 .show = proc_keys_show,
34}; 34};
35 35
36static struct file_operations proc_keys_fops = { 36static const struct file_operations proc_keys_fops = {
37 .open = proc_keys_open, 37 .open = proc_keys_open,
38 .read = seq_read, 38 .read = seq_read,
39 .llseek = seq_lseek, 39 .llseek = seq_lseek,
@@ -54,7 +54,7 @@ static struct seq_operations proc_key_users_ops = {
54 .show = proc_key_users_show, 54 .show = proc_key_users_show,
55}; 55};
56 56
57static struct file_operations proc_key_users_fops = { 57static const struct file_operations proc_key_users_fops = {
58 .open = proc_key_users_open, 58 .open = proc_key_users_open,
59 .read = seq_read, 59 .read = seq_read,
60 .llseek = seq_lseek, 60 .llseek = seq_lseek,
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index e7c0b5e206..da8caf10ef 100644
--- a/security/selinux/avc.c
+++ b/security/selinux/avc.c
@@ -332,11 +332,10 @@ static struct avc_node *avc_alloc_node(void)
332{ 332{
333 struct avc_node *node; 333 struct avc_node *node;
334 334
335 node = kmem_cache_alloc(avc_node_cachep, GFP_ATOMIC); 335 node = kmem_cache_zalloc(avc_node_cachep, GFP_ATOMIC);
336 if (!node) 336 if (!node)
337 goto out; 337 goto out;
338 338
339 memset(node, 0, sizeof(*node));
340 INIT_RCU_HEAD(&node->rhead); 339 INIT_RCU_HEAD(&node->rhead);
341 INIT_LIST_HEAD(&node->list); 340 INIT_LIST_HEAD(&node->list);
342 atomic_set(&node->ae.used, 1); 341 atomic_set(&node->ae.used, 1);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 65fb5e8ea9..35eb8de892 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -181,11 +181,10 @@ static int inode_alloc_security(struct inode *inode)
181 struct task_security_struct *tsec = current->security; 181 struct task_security_struct *tsec = current->security;
182 struct inode_security_struct *isec; 182 struct inode_security_struct *isec;
183 183
184 isec = kmem_cache_alloc(sel_inode_cache, GFP_KERNEL); 184 isec = kmem_cache_zalloc(sel_inode_cache, GFP_KERNEL);
185 if (!isec) 185 if (!isec)
186 return -ENOMEM; 186 return -ENOMEM;
187 187
188 memset(isec, 0, sizeof(*isec));
189 mutex_init(&isec->lock); 188 mutex_init(&isec->lock);
190 INIT_LIST_HEAD(&isec->list); 189 INIT_LIST_HEAD(&isec->list);
191 isec->inode = inode; 190 isec->inode = inode;
@@ -2655,7 +2654,7 @@ static int selinux_file_send_sigiotask(struct task_struct *tsk,
2655 struct file_security_struct *fsec; 2654 struct file_security_struct *fsec;
2656 2655
2657 /* struct fown_struct is never outside the context of a struct file */ 2656 /* struct fown_struct is never outside the context of a struct file */
2658 file = (struct file *)((long)fown - offsetof(struct file,f_owner)); 2657 file = container_of(fown, struct file, f_owner);
2659 2658
2660 tsec = tsk->security; 2659 tsec = tsk->security;
2661 fsec = file->f_security; 2660 fsec = file->f_security;
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index c8bf6e172f..93b3177c75 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -161,7 +161,7 @@ out:
161#define sel_write_enforce NULL 161#define sel_write_enforce NULL
162#endif 162#endif
163 163
164static struct file_operations sel_enforce_ops = { 164static const struct file_operations sel_enforce_ops = {
165 .read = sel_read_enforce, 165 .read = sel_read_enforce,
166 .write = sel_write_enforce, 166 .write = sel_write_enforce,
167}; 167};
@@ -211,7 +211,7 @@ out:
211#define sel_write_disable NULL 211#define sel_write_disable NULL
212#endif 212#endif
213 213
214static struct file_operations sel_disable_ops = { 214static const struct file_operations sel_disable_ops = {
215 .write = sel_write_disable, 215 .write = sel_write_disable,
216}; 216};
217 217
@@ -225,7 +225,7 @@ static ssize_t sel_read_policyvers(struct file *filp, char __user *buf,
225 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); 225 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
226} 226}
227 227
228static struct file_operations sel_policyvers_ops = { 228static const struct file_operations sel_policyvers_ops = {
229 .read = sel_read_policyvers, 229 .read = sel_read_policyvers,
230}; 230};
231 231
@@ -242,7 +242,7 @@ static ssize_t sel_read_mls(struct file *filp, char __user *buf,
242 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length); 242 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
243} 243}
244 244
245static struct file_operations sel_mls_ops = { 245static const struct file_operations sel_mls_ops = {
246 .read = sel_read_mls, 246 .read = sel_read_mls,
247}; 247};
248 248
@@ -294,7 +294,7 @@ out:
294 return length; 294 return length;
295} 295}
296 296
297static struct file_operations sel_load_ops = { 297static const struct file_operations sel_load_ops = {
298 .write = sel_write_load, 298 .write = sel_write_load,
299}; 299};
300 300
@@ -374,7 +374,7 @@ out:
374 free_page((unsigned long) page); 374 free_page((unsigned long) page);
375 return length; 375 return length;
376} 376}
377static struct file_operations sel_checkreqprot_ops = { 377static const struct file_operations sel_checkreqprot_ops = {
378 .read = sel_read_checkreqprot, 378 .read = sel_read_checkreqprot,
379 .write = sel_write_checkreqprot, 379 .write = sel_write_checkreqprot,
380}; 380};
@@ -423,7 +423,7 @@ out:
423 free_page((unsigned long) page); 423 free_page((unsigned long) page);
424 return length; 424 return length;
425} 425}
426static struct file_operations sel_compat_net_ops = { 426static const struct file_operations sel_compat_net_ops = {
427 .read = sel_read_compat_net, 427 .read = sel_read_compat_net,
428 .write = sel_write_compat_net, 428 .write = sel_write_compat_net,
429}; 429};
@@ -467,7 +467,7 @@ static ssize_t selinux_transaction_write(struct file *file, const char __user *b
467 return rv; 467 return rv;
468} 468}
469 469
470static struct file_operations transaction_ops = { 470static const struct file_operations transaction_ops = {
471 .write = selinux_transaction_write, 471 .write = selinux_transaction_write,
472 .read = simple_transaction_read, 472 .read = simple_transaction_read,
473 .release = simple_transaction_release, 473 .release = simple_transaction_release,
@@ -875,7 +875,7 @@ out:
875 return length; 875 return length;
876} 876}
877 877
878static struct file_operations sel_bool_ops = { 878static const struct file_operations sel_bool_ops = {
879 .read = sel_read_bool, 879 .read = sel_read_bool,
880 .write = sel_write_bool, 880 .write = sel_write_bool,
881}; 881};
@@ -932,7 +932,7 @@ out:
932 return length; 932 return length;
933} 933}
934 934
935static struct file_operations sel_commit_bools_ops = { 935static const struct file_operations sel_commit_bools_ops = {
936 .write = sel_commit_bools_write, 936 .write = sel_commit_bools_write,
937}; 937};
938 938
@@ -1131,12 +1131,12 @@ out:
1131 return ret; 1131 return ret;
1132} 1132}
1133 1133
1134static struct file_operations sel_avc_cache_threshold_ops = { 1134static const struct file_operations sel_avc_cache_threshold_ops = {
1135 .read = sel_read_avc_cache_threshold, 1135 .read = sel_read_avc_cache_threshold,
1136 .write = sel_write_avc_cache_threshold, 1136 .write = sel_write_avc_cache_threshold,
1137}; 1137};
1138 1138
1139static struct file_operations sel_avc_hash_stats_ops = { 1139static const struct file_operations sel_avc_hash_stats_ops = {
1140 .read = sel_read_avc_hash_stats, 1140 .read = sel_read_avc_hash_stats,
1141}; 1141};
1142 1142
@@ -1198,7 +1198,7 @@ static int sel_open_avc_cache_stats(struct inode *inode, struct file *file)
1198 return seq_open(file, &sel_avc_cache_stats_seq_ops); 1198 return seq_open(file, &sel_avc_cache_stats_seq_ops);
1199} 1199}
1200 1200
1201static struct file_operations sel_avc_cache_stats_ops = { 1201static const struct file_operations sel_avc_cache_stats_ops = {
1202 .open = sel_open_avc_cache_stats, 1202 .open = sel_open_avc_cache_stats,
1203 .read = seq_read, 1203 .read = seq_read,
1204 .llseek = seq_lseek, 1204 .llseek = seq_lseek,
diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
index ebb993c5c2..9142073319 100644
--- a/security/selinux/ss/avtab.c
+++ b/security/selinux/ss/avtab.c
@@ -36,10 +36,9 @@ avtab_insert_node(struct avtab *h, int hvalue,
36 struct avtab_key *key, struct avtab_datum *datum) 36 struct avtab_key *key, struct avtab_datum *datum)
37{ 37{
38 struct avtab_node * newnode; 38 struct avtab_node * newnode;
39 newnode = kmem_cache_alloc(avtab_node_cachep, GFP_KERNEL); 39 newnode = kmem_cache_zalloc(avtab_node_cachep, GFP_KERNEL);
40 if (newnode == NULL) 40 if (newnode == NULL)
41 return NULL; 41 return NULL;
42 memset(newnode, 0, sizeof(struct avtab_node));
43 newnode->key = *key; 42 newnode->key = *key;
44 newnode->datum = *datum; 43 newnode->datum = *datum;
45 if (prev) { 44 if (prev) {