aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipc/sem.c3
-rw-r--r--kernel/auditfilter.c3
-rw-r--r--kernel/futex.c3
-rw-r--r--kernel/kexec.c3
-rw-r--r--lib/kobject.c3
-rw-r--r--mm/nommu.c6
6 files changed, 7 insertions, 14 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 21b3289d640c..d3e12efd55cb 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1070,14 +1070,13 @@ static struct sem_undo *find_undo(struct ipc_namespace *ns, int semid)
1070 ipc_rcu_getref(sma); 1070 ipc_rcu_getref(sma);
1071 sem_unlock(sma); 1071 sem_unlock(sma);
1072 1072
1073 new = (struct sem_undo *) kmalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL); 1073 new = kzalloc(sizeof(struct sem_undo) + sizeof(short)*nsems, GFP_KERNEL);
1074 if (!new) { 1074 if (!new) {
1075 ipc_lock_by_ptr(&sma->sem_perm); 1075 ipc_lock_by_ptr(&sma->sem_perm);
1076 ipc_rcu_putref(sma); 1076 ipc_rcu_putref(sma);
1077 sem_unlock(sma); 1077 sem_unlock(sma);
1078 return ERR_PTR(-ENOMEM); 1078 return ERR_PTR(-ENOMEM);
1079 } 1079 }
1080 memset(new, 0, sizeof(struct sem_undo) + sizeof(short)*nsems);
1081 new->semadj = (short *) &new[1]; 1080 new->semadj = (short *) &new[1];
1082 new->semid = semid; 1081 new->semid = semid;
1083 1082
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index 4f40d923af8e..2e896f8ae29e 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -636,10 +636,9 @@ static struct audit_rule *audit_krule_to_rule(struct audit_krule *krule)
636 struct audit_rule *rule; 636 struct audit_rule *rule;
637 int i; 637 int i;
638 638
639 rule = kmalloc(sizeof(*rule), GFP_KERNEL); 639 rule = kzalloc(sizeof(*rule), GFP_KERNEL);
640 if (unlikely(!rule)) 640 if (unlikely(!rule))
641 return NULL; 641 return NULL;
642 memset(rule, 0, sizeof(*rule));
643 642
644 rule->flags = krule->flags | krule->listnr; 643 rule->flags = krule->flags | krule->listnr;
645 rule->action = krule->action; 644 rule->action = krule->action;
diff --git a/kernel/futex.c b/kernel/futex.c
index af7b81cbde30..7c0d0d4fa7f7 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -324,12 +324,11 @@ static int refill_pi_state_cache(void)
324 if (likely(current->pi_state_cache)) 324 if (likely(current->pi_state_cache))
325 return 0; 325 return 0;
326 326
327 pi_state = kmalloc(sizeof(*pi_state), GFP_KERNEL); 327 pi_state = kzalloc(sizeof(*pi_state), GFP_KERNEL);
328 328
329 if (!pi_state) 329 if (!pi_state)
330 return -ENOMEM; 330 return -ENOMEM;
331 331
332 memset(pi_state, 0, sizeof(*pi_state));
333 INIT_LIST_HEAD(&pi_state->list); 332 INIT_LIST_HEAD(&pi_state->list);
334 /* pi_mutex gets initialized later */ 333 /* pi_mutex gets initialized later */
335 pi_state->owner = NULL; 334 pi_state->owner = NULL;
diff --git a/kernel/kexec.c b/kernel/kexec.c
index fcdd5d2bc3f4..d43692cf2321 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -108,11 +108,10 @@ static int do_kimage_alloc(struct kimage **rimage, unsigned long entry,
108 108
109 /* Allocate a controlling structure */ 109 /* Allocate a controlling structure */
110 result = -ENOMEM; 110 result = -ENOMEM;
111 image = kmalloc(sizeof(*image), GFP_KERNEL); 111 image = kzalloc(sizeof(*image), GFP_KERNEL);
112 if (!image) 112 if (!image)
113 goto out; 113 goto out;
114 114
115 memset(image, 0, sizeof(*image));
116 image->head = 0; 115 image->head = 0;
117 image->entry = &image->head; 116 image->entry = &image->head;
118 image->last_entry = &image->head; 117 image->last_entry = &image->head;
diff --git a/lib/kobject.c b/lib/kobject.c
index 744a4b102c7f..7ce6dc138e90 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -111,10 +111,9 @@ char *kobject_get_path(struct kobject *kobj, gfp_t gfp_mask)
111 len = get_kobj_path_length(kobj); 111 len = get_kobj_path_length(kobj);
112 if (len == 0) 112 if (len == 0)
113 return NULL; 113 return NULL;
114 path = kmalloc(len, gfp_mask); 114 path = kzalloc(len, gfp_mask);
115 if (!path) 115 if (!path)
116 return NULL; 116 return NULL;
117 memset(path, 0x00, len);
118 fill_kobj_path(kobj, path, len); 117 fill_kobj_path(kobj, path, len);
119 118
120 return path; 119 return path;
diff --git a/mm/nommu.c b/mm/nommu.c
index 6a2a8aada401..af874569d0f1 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -808,10 +808,9 @@ unsigned long do_mmap_pgoff(struct file *file,
808 vm_flags = determine_vm_flags(file, prot, flags, capabilities); 808 vm_flags = determine_vm_flags(file, prot, flags, capabilities);
809 809
810 /* we're going to need to record the mapping if it works */ 810 /* we're going to need to record the mapping if it works */
811 vml = kmalloc(sizeof(struct vm_list_struct), GFP_KERNEL); 811 vml = kzalloc(sizeof(struct vm_list_struct), GFP_KERNEL);
812 if (!vml) 812 if (!vml)
813 goto error_getting_vml; 813 goto error_getting_vml;
814 memset(vml, 0, sizeof(*vml));
815 814
816 down_write(&nommu_vma_sem); 815 down_write(&nommu_vma_sem);
817 816
@@ -887,11 +886,10 @@ unsigned long do_mmap_pgoff(struct file *file,
887 } 886 }
888 887
889 /* we're going to need a VMA struct as well */ 888 /* we're going to need a VMA struct as well */
890 vma = kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL); 889 vma = kzalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
891 if (!vma) 890 if (!vma)
892 goto error_getting_vma; 891 goto error_getting_vma;
893 892
894 memset(vma, 0, sizeof(*vma));
895 INIT_LIST_HEAD(&vma->anon_vma_node); 893 INIT_LIST_HEAD(&vma->anon_vma_node);
896 atomic_set(&vma->vm_usage, 1); 894 atomic_set(&vma->vm_usage, 1);
897 if (file) 895 if (file)