aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@mindspring.com>2007-02-10 04:45:03 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:27 -0500
commitc376222960ae91d5ffb9197ee36771aaed1d9f90 (patch)
tree7f431c42529fec77433d33490bd9f2a8c47ba091
parent1b135431abf5ea92e61bf4e91d93726c7b96da5f (diff)
[PATCH] Transform kmem_cache_alloc()+memset(0) -> kmem_cache_zalloc().
Replace appropriate pairs of "kmem_cache_alloc()" + "memset(0)" with the corresponding "kmem_cache_zalloc()" call. Signed-off-by: Robert P. J. Day <rpjday@mindspring.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Andi Kleen <ak@muc.de> Cc: Roland McGrath <roland@redhat.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Cc: Greg KH <greg@kroah.com> Acked-by: Joel Becker <Joel.Becker@oracle.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Jan Kara <jack@ucw.cz> Cc: Michael Halcrow <mhalcrow@us.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: James Morris <jmorris@namei.org> Cc: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/ia64/ia32/binfmt_elf32.c13
-rw-r--r--arch/ia64/kernel/perfmon.c3
-rw-r--r--arch/ia64/mm/init.c6
-rw-r--r--arch/x86_64/ia32/ia32_binfmt.c4
-rw-r--r--drivers/infiniband/hw/ehca/ehca_cq.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_mrmw.c6
-rw-r--r--drivers/infiniband/hw/ehca/ehca_pd.c3
-rw-r--r--drivers/infiniband/hw/ehca/ehca_qp.c3
-rw-r--r--drivers/scsi/aic94xx/aic94xx_hwi.c3
-rw-r--r--drivers/scsi/scsi_lib.c3
-rw-r--r--drivers/usb/host/hc_crisv10.c3
-rw-r--r--drivers/usb/host/uhci-q.c4
-rw-r--r--fs/aio.c3
-rw-r--r--fs/configfs/dir.c3
-rw-r--r--fs/dlm/memory.c4
-rw-r--r--fs/dquot.c3
-rw-r--r--fs/ecryptfs/crypto.c4
-rw-r--r--fs/ecryptfs/file.c3
-rw-r--r--fs/ecryptfs/inode.c5
-rw-r--r--fs/ecryptfs/keystore.c4
-rw-r--r--fs/ecryptfs/main.c8
-rw-r--r--fs/exec.c4
-rw-r--r--fs/gfs2/meta_io.c3
-rw-r--r--fs/namespace.c3
-rw-r--r--fs/smbfs/request.c3
-rw-r--r--fs/sysfs/dir.c3
-rw-r--r--include/scsi/libsas.h3
-rw-r--r--kernel/posix-timers.c3
-rw-r--r--net/core/dst.c3
-rw-r--r--net/core/neighbour.c4
-rw-r--r--net/decnet/dn_table.c4
-rw-r--r--net/ipv4/ipmr.c6
-rw-r--r--net/ipv4/ipvs/ip_vs_conn.c3
-rw-r--r--net/ipv4/netfilter/ip_conntrack_core.c3
-rw-r--r--net/ipv6/ip6_fib.c3
-rw-r--r--net/sctp/sm_make_chunk.c3
-rw-r--r--security/selinux/avc.c3
-rw-r--r--security/selinux/hooks.c3
-rw-r--r--security/selinux/ss/avtab.c3
39 files changed, 48 insertions, 103 deletions
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
index 578737ec7629..c05bda662364 100644
--- a/arch/ia64/ia32/binfmt_elf32.c
+++ b/arch/ia64/ia32/binfmt_elf32.c
@@ -91,9 +91,8 @@ ia64_elf32_init (struct pt_regs *regs)
91 * it with privilege level 3 because the IVE uses non-privileged accesses to these 91 * it with privilege level 3 because the IVE uses non-privileged accesses to these
92 * tables. IA-32 segmentation is used to protect against IA-32 accesses to them. 92 * tables. IA-32 segmentation is used to protect against IA-32 accesses to them.
93 */ 93 */
94 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 94 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
95 if (vma) { 95 if (vma) {
96 memset(vma, 0, sizeof(*vma));
97 vma->vm_mm = current->mm; 96 vma->vm_mm = current->mm;
98 vma->vm_start = IA32_GDT_OFFSET; 97 vma->vm_start = IA32_GDT_OFFSET;
99 vma->vm_end = vma->vm_start + PAGE_SIZE; 98 vma->vm_end = vma->vm_start + PAGE_SIZE;
@@ -117,9 +116,8 @@ ia64_elf32_init (struct pt_regs *regs)
117 * code is locked in specific gate page, which is pointed by pretcode 116 * code is locked in specific gate page, which is pointed by pretcode
118 * when setup_frame_ia32 117 * when setup_frame_ia32
119 */ 118 */
120 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 119 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
121 if (vma) { 120 if (vma) {
122 memset(vma, 0, sizeof(*vma));
123 vma->vm_mm = current->mm; 121 vma->vm_mm = current->mm;
124 vma->vm_start = IA32_GATE_OFFSET; 122 vma->vm_start = IA32_GATE_OFFSET;
125 vma->vm_end = vma->vm_start + PAGE_SIZE; 123 vma->vm_end = vma->vm_start + PAGE_SIZE;
@@ -142,9 +140,8 @@ ia64_elf32_init (struct pt_regs *regs)
142 * Install LDT as anonymous memory. This gives us all-zero segment descriptors 140 * Install LDT as anonymous memory. This gives us all-zero segment descriptors
143 * until a task modifies them via modify_ldt(). 141 * until a task modifies them via modify_ldt().
144 */ 142 */
145 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 143 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
146 if (vma) { 144 if (vma) {
147 memset(vma, 0, sizeof(*vma));
148 vma->vm_mm = current->mm; 145 vma->vm_mm = current->mm;
149 vma->vm_start = IA32_LDT_OFFSET; 146 vma->vm_start = IA32_LDT_OFFSET;
150 vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE); 147 vma->vm_end = vma->vm_start + PAGE_ALIGN(IA32_LDT_ENTRIES*IA32_LDT_ENTRY_SIZE);
@@ -214,12 +211,10 @@ ia32_setup_arg_pages (struct linux_binprm *bprm, int executable_stack)
214 bprm->loader += stack_base; 211 bprm->loader += stack_base;
215 bprm->exec += stack_base; 212 bprm->exec += stack_base;
216 213
217 mpnt = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 214 mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
218 if (!mpnt) 215 if (!mpnt)
219 return -ENOMEM; 216 return -ENOMEM;
220 217
221 memset(mpnt, 0, sizeof(*mpnt));
222
223 down_write(&current->mm->mmap_sem); 218 down_write(&current->mm->mmap_sem);
224 { 219 {
225 mpnt->vm_mm = current->mm; 220 mpnt->vm_mm = current->mm;
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index aa94f60fa8e7..86e144f321ff 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2301,12 +2301,11 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon
2301 DPRINT(("smpl_buf @%p\n", smpl_buf)); 2301 DPRINT(("smpl_buf @%p\n", smpl_buf));
2302 2302
2303 /* allocate vma */ 2303 /* allocate vma */
2304 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 2304 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
2305 if (!vma) { 2305 if (!vma) {
2306 DPRINT(("Cannot allocate vma\n")); 2306 DPRINT(("Cannot allocate vma\n"));
2307 goto error_kmem; 2307 goto error_kmem;
2308 } 2308 }
2309 memset(vma, 0, sizeof(*vma));
2310 2309
2311 /* 2310 /*
2312 * partially initialize the vma for the sampling buffer 2311 * partially initialize the vma for the sampling buffer
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 760dda4d5b6e..f225dd72968b 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -176,9 +176,8 @@ ia64_init_addr_space (void)
176 * the problem. When the process attempts to write to the register backing store 176 * the problem. When the process attempts to write to the register backing store
177 * for the first time, it will get a SEGFAULT in this case. 177 * for the first time, it will get a SEGFAULT in this case.
178 */ 178 */
179 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 179 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
180 if (vma) { 180 if (vma) {
181 memset(vma, 0, sizeof(*vma));
182 vma->vm_mm = current->mm; 181 vma->vm_mm = current->mm;
183 vma->vm_start = current->thread.rbs_bot & PAGE_MASK; 182 vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
184 vma->vm_end = vma->vm_start + PAGE_SIZE; 183 vma->vm_end = vma->vm_start + PAGE_SIZE;
@@ -195,9 +194,8 @@ ia64_init_addr_space (void)
195 194
196 /* map NaT-page at address zero to speed up speculative dereferencing of NULL: */ 195 /* map NaT-page at address zero to speed up speculative dereferencing of NULL: */
197 if (!(current->personality & MMAP_PAGE_ZERO)) { 196 if (!(current->personality & MMAP_PAGE_ZERO)) {
198 vma = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 197 vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
199 if (vma) { 198 if (vma) {
200 memset(vma, 0, sizeof(*vma));
201 vma->vm_mm = current->mm; 199 vma->vm_mm = current->mm;
202 vma->vm_end = PAGE_SIZE; 200 vma->vm_end = PAGE_SIZE;
203 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT); 201 vma->vm_page_prot = __pgprot(pgprot_val(PAGE_READONLY) | _PAGE_MA_NAT);
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index 5ce0bd486bbf..6efe04f3cbca 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -300,12 +300,10 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top,
300 bprm->loader += stack_base; 300 bprm->loader += stack_base;
301 bprm->exec += stack_base; 301 bprm->exec += stack_base;
302 302
303 mpnt = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 303 mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
304 if (!mpnt) 304 if (!mpnt)
305 return -ENOMEM; 305 return -ENOMEM;
306 306
307 memset(mpnt, 0, sizeof(*mpnt));
308
309 down_write(&mm->mmap_sem); 307 down_write(&mm->mmap_sem);
310 { 308 {
311 mpnt->vm_mm = mm; 309 mpnt->vm_mm = mm;
diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
index 9291a86ca053..6ebfa27e4e16 100644
--- a/drivers/infiniband/hw/ehca/ehca_cq.c
+++ b/drivers/infiniband/hw/ehca/ehca_cq.c
@@ -134,14 +134,13 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe,
134 if (cqe >= 0xFFFFFFFF - 64 - additional_cqe) 134 if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
135 return ERR_PTR(-EINVAL); 135 return ERR_PTR(-EINVAL);
136 136
137 my_cq = kmem_cache_alloc(cq_cache, GFP_KERNEL); 137 my_cq = kmem_cache_zalloc(cq_cache, GFP_KERNEL);
138 if (!my_cq) { 138 if (!my_cq) {
139 ehca_err(device, "Out of memory for ehca_cq struct device=%p", 139 ehca_err(device, "Out of memory for ehca_cq struct device=%p",
140 device); 140 device);
141 return ERR_PTR(-ENOMEM); 141 return ERR_PTR(-ENOMEM);
142 } 142 }
143 143
144 memset(my_cq, 0, sizeof(struct ehca_cq));
145 memset(&param, 0, sizeof(struct ehca_alloc_cq_parms)); 144 memset(&param, 0, sizeof(struct ehca_alloc_cq_parms));
146 145
147 spin_lock_init(&my_cq->spinlock); 146 spin_lock_init(&my_cq->spinlock);
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index cfb362a1029c..d22ab563633f 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -53,9 +53,8 @@ static struct ehca_mr *ehca_mr_new(void)
53{ 53{
54 struct ehca_mr *me; 54 struct ehca_mr *me;
55 55
56 me = kmem_cache_alloc(mr_cache, GFP_KERNEL); 56 me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
57 if (me) { 57 if (me) {
58 memset(me, 0, sizeof(struct ehca_mr));
59 spin_lock_init(&me->mrlock); 58 spin_lock_init(&me->mrlock);
60 } else 59 } else
61 ehca_gen_err("alloc failed"); 60 ehca_gen_err("alloc failed");
@@ -72,9 +71,8 @@ static struct ehca_mw *ehca_mw_new(void)
72{ 71{
73 struct ehca_mw *me; 72 struct ehca_mw *me;
74 73
75 me = kmem_cache_alloc(mw_cache, GFP_KERNEL); 74 me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
76 if (me) { 75 if (me) {
77 memset(me, 0, sizeof(struct ehca_mw));
78 spin_lock_init(&me->mwlock); 76 spin_lock_init(&me->mwlock);
79 } else 77 } else
80 ehca_gen_err("alloc failed"); 78 ehca_gen_err("alloc failed");
diff --git a/drivers/infiniband/hw/ehca/ehca_pd.c b/drivers/infiniband/hw/ehca/ehca_pd.c
index d5345e5b3cd6..79d0591a8043 100644
--- a/drivers/infiniband/hw/ehca/ehca_pd.c
+++ b/drivers/infiniband/hw/ehca/ehca_pd.c
@@ -50,14 +50,13 @@ struct ib_pd *ehca_alloc_pd(struct ib_device *device,
50{ 50{
51 struct ehca_pd *pd; 51 struct ehca_pd *pd;
52 52
53 pd = kmem_cache_alloc(pd_cache, GFP_KERNEL); 53 pd = kmem_cache_zalloc(pd_cache, GFP_KERNEL);
54 if (!pd) { 54 if (!pd) {
55 ehca_err(device, "device=%p context=%p out of memory", 55 ehca_err(device, "device=%p context=%p out of memory",
56 device, context); 56 device, context);
57 return ERR_PTR(-ENOMEM); 57 return ERR_PTR(-ENOMEM);
58 } 58 }
59 59
60 memset(pd, 0, sizeof(struct ehca_pd));
61 pd->ownpid = current->tgid; 60 pd->ownpid = current->tgid;
62 61
63 /* 62 /*
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 95efef921f1d..df0516f24379 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -450,13 +450,12 @@ struct ib_qp *ehca_create_qp(struct ib_pd *pd,
450 if (pd->uobject && udata) 450 if (pd->uobject && udata)
451 context = pd->uobject->context; 451 context = pd->uobject->context;
452 452
453 my_qp = kmem_cache_alloc(qp_cache, GFP_KERNEL); 453 my_qp = kmem_cache_zalloc(qp_cache, GFP_KERNEL);
454 if (!my_qp) { 454 if (!my_qp) {
455 ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd); 455 ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd);
456 return ERR_PTR(-ENOMEM); 456 return ERR_PTR(-ENOMEM);
457 } 457 }
458 458
459 memset(my_qp, 0, sizeof(struct ehca_qp));
460 memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms)); 459 memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms));
461 spin_lock_init(&my_qp->spinlock_s); 460 spin_lock_init(&my_qp->spinlock_s);
462 spin_lock_init(&my_qp->spinlock_r); 461 spin_lock_init(&my_qp->spinlock_r);
diff --git a/drivers/scsi/aic94xx/aic94xx_hwi.c b/drivers/scsi/aic94xx/aic94xx_hwi.c
index da94e126ca83..0cd7eed9196c 100644
--- a/drivers/scsi/aic94xx/aic94xx_hwi.c
+++ b/drivers/scsi/aic94xx/aic94xx_hwi.c
@@ -1052,10 +1052,9 @@ static inline struct asd_ascb *asd_ascb_alloc(struct asd_ha_struct *asd_ha,
1052 struct asd_ascb *ascb; 1052 struct asd_ascb *ascb;
1053 unsigned long flags; 1053 unsigned long flags;
1054 1054
1055 ascb = kmem_cache_alloc(asd_ascb_cache, gfp_flags); 1055 ascb = kmem_cache_zalloc(asd_ascb_cache, gfp_flags);
1056 1056
1057 if (ascb) { 1057 if (ascb) {
1058 memset(ascb, 0, sizeof(*ascb));
1059 ascb->dma_scb.size = sizeof(struct scb); 1058 ascb->dma_scb.size = sizeof(struct scb);
1060 ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool, 1059 ascb->dma_scb.vaddr = dma_pool_alloc(asd_ha->scb_pool,
1061 gfp_flags, 1060 gfp_flags,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index f02f48a882a9..a1cd6e6a292a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -388,10 +388,9 @@ int scsi_execute_async(struct scsi_device *sdev, const unsigned char *cmd,
388 int err = 0; 388 int err = 0;
389 int write = (data_direction == DMA_TO_DEVICE); 389 int write = (data_direction == DMA_TO_DEVICE);
390 390
391 sioc = kmem_cache_alloc(scsi_io_context_cache, gfp); 391 sioc = kmem_cache_zalloc(scsi_io_context_cache, gfp);
392 if (!sioc) 392 if (!sioc)
393 return DRIVER_ERROR << 24; 393 return DRIVER_ERROR << 24;
394 memset(sioc, 0, sizeof(*sioc));
395 394
396 req = blk_get_request(sdev->request_queue, write, gfp); 395 req = blk_get_request(sdev->request_queue, write, gfp);
397 if (!req) 396 if (!req)
diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c
index 282d82efc0b0..f0ffb8907f29 100644
--- a/drivers/usb/host/hc_crisv10.c
+++ b/drivers/usb/host/hc_crisv10.c
@@ -2163,9 +2163,8 @@ static void etrax_usb_add_to_bulk_sb_list(struct urb *urb, int epid)
2163 2163
2164 maxlen = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe)); 2164 maxlen = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
2165 2165
2166 sb_desc = (USB_SB_Desc_t*)kmem_cache_alloc(usb_desc_cache, SLAB_FLAG); 2166 sb_desc = kmem_cache_zalloc(usb_desc_cache, SLAB_FLAG);
2167 assert(sb_desc != NULL); 2167 assert(sb_desc != NULL);
2168 memset(sb_desc, 0, sizeof(USB_SB_Desc_t));
2169 2168
2170 2169
2171 if (usb_pipeout(urb->pipe)) { 2170 if (usb_pipeout(urb->pipe)) {
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 2cbb239e63f8..68e66b33e726 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -624,12 +624,10 @@ static inline struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci,
624{ 624{
625 struct urb_priv *urbp; 625 struct urb_priv *urbp;
626 626
627 urbp = kmem_cache_alloc(uhci_up_cachep, GFP_ATOMIC); 627 urbp = kmem_cache_zalloc(uhci_up_cachep, GFP_ATOMIC);
628 if (!urbp) 628 if (!urbp)
629 return NULL; 629 return NULL;
630 630
631 memset((void *)urbp, 0, sizeof(*urbp));
632
633 urbp->urb = urb; 631 urbp->urb = urb;
634 urb->hcpriv = urbp; 632 urb->hcpriv = urbp;
635 633
diff --git a/fs/aio.c b/fs/aio.c
index ee662589e5ec..0b4ee0a5c83e 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -211,11 +211,10 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
211 if ((unsigned long)nr_events > aio_max_nr) 211 if ((unsigned long)nr_events > aio_max_nr)
212 return ERR_PTR(-EAGAIN); 212 return ERR_PTR(-EAGAIN);
213 213
214 ctx = kmem_cache_alloc(kioctx_cachep, GFP_KERNEL); 214 ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);
215 if (!ctx) 215 if (!ctx)
216 return ERR_PTR(-ENOMEM); 216 return ERR_PTR(-ENOMEM);
217 217
218 memset(ctx, 0, sizeof(*ctx));
219 ctx->max_reqs = nr_events; 218 ctx->max_reqs = nr_events;
220 mm = ctx->mm = current->mm; 219 mm = ctx->mm = current->mm;
221 atomic_inc(&mm->mm_count); 220 atomic_inc(&mm->mm_count);
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 1814ba446809..9371ee209954 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -72,11 +72,10 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
72{ 72{
73 struct configfs_dirent * sd; 73 struct configfs_dirent * sd;
74 74
75 sd = kmem_cache_alloc(configfs_dir_cachep, GFP_KERNEL); 75 sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL);
76 if (!sd) 76 if (!sd)
77 return NULL; 77 return NULL;
78 78
79 memset(sd, 0, sizeof(*sd));
80 atomic_set(&sd->s_count, 1); 79 atomic_set(&sd->s_count, 1);
81 INIT_LIST_HEAD(&sd->s_links); 80 INIT_LIST_HEAD(&sd->s_links);
82 INIT_LIST_HEAD(&sd->s_children); 81 INIT_LIST_HEAD(&sd->s_children);
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 5352b03ff5aa..f858fef6e41c 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -76,9 +76,7 @@ struct dlm_lkb *allocate_lkb(struct dlm_ls *ls)
76{ 76{
77 struct dlm_lkb *lkb; 77 struct dlm_lkb *lkb;
78 78
79 lkb = kmem_cache_alloc(lkb_cache, GFP_KERNEL); 79 lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL);
80 if (lkb)
81 memset(lkb, 0, sizeof(*lkb));
82 return lkb; 80 return lkb;
83} 81}
84 82
diff --git a/fs/dquot.c b/fs/dquot.c
index 0952cc474d9a..a561fb29e203 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -600,11 +600,10 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
600{ 600{
601 struct dquot *dquot; 601 struct dquot *dquot;
602 602
603 dquot = kmem_cache_alloc(dquot_cachep, GFP_NOFS); 603 dquot = kmem_cache_zalloc(dquot_cachep, GFP_NOFS);
604 if(!dquot) 604 if(!dquot)
605 return NODQUOT; 605 return NODQUOT;
606 606
607 memset((caddr_t)dquot, 0, sizeof(struct dquot));
608 mutex_init(&dquot->dq_lock); 607 mutex_init(&dquot->dq_lock);
609 INIT_LIST_HEAD(&dquot->dq_free); 608 INIT_LIST_HEAD(&dquot->dq_free);
610 INIT_LIST_HEAD(&dquot->dq_inuse); 609 INIT_LIST_HEAD(&dquot->dq_inuse);
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index a86a55ccf874..75bbfae55081 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1332,13 +1332,13 @@ int ecryptfs_write_headers(struct dentry *ecryptfs_dentry,
1332 goto out; 1332 goto out;
1333 } 1333 }
1334 /* Released in this function */ 1334 /* Released in this function */
1335 page_virt = kmem_cache_alloc(ecryptfs_header_cache_0, GFP_USER); 1335 page_virt = kmem_cache_zalloc(ecryptfs_header_cache_0, GFP_USER);
1336 if (!page_virt) { 1336 if (!page_virt) {
1337 ecryptfs_printk(KERN_ERR, "Out of memory\n"); 1337 ecryptfs_printk(KERN_ERR, "Out of memory\n");
1338 rc = -ENOMEM; 1338 rc = -ENOMEM;
1339 goto out; 1339 goto out;
1340 } 1340 }
1341 memset(page_virt, 0, PAGE_CACHE_SIZE); 1341
1342 rc = ecryptfs_write_headers_virt(page_virt, crypt_stat, 1342 rc = ecryptfs_write_headers_virt(page_virt, crypt_stat,
1343 ecryptfs_dentry); 1343 ecryptfs_dentry);
1344 if (unlikely(rc)) { 1344 if (unlikely(rc)) {
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index c5a2e5298f15..779c3477d93c 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -251,7 +251,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
251 int lower_flags; 251 int lower_flags;
252 252
253 /* Released in ecryptfs_release or end of function if failure */ 253 /* Released in ecryptfs_release or end of function if failure */
254 file_info = kmem_cache_alloc(ecryptfs_file_info_cache, GFP_KERNEL); 254 file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
255 ecryptfs_set_file_private(file, file_info); 255 ecryptfs_set_file_private(file, file_info);
256 if (!file_info) { 256 if (!file_info) {
257 ecryptfs_printk(KERN_ERR, 257 ecryptfs_printk(KERN_ERR,
@@ -259,7 +259,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
259 rc = -ENOMEM; 259 rc = -ENOMEM;
260 goto out; 260 goto out;
261 } 261 }
262 memset(file_info, 0, sizeof(*file_info));
263 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); 262 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
264 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; 263 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
265 mount_crypt_stat = &ecryptfs_superblock_to_private( 264 mount_crypt_stat = &ecryptfs_superblock_to_private(
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 11f5e5076aef..d4f02f3e18d7 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -361,8 +361,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
361 goto out; 361 goto out;
362 } 362 }
363 /* Released in this function */ 363 /* Released in this function */
364 page_virt = 364 page_virt = kmem_cache_zalloc(ecryptfs_header_cache_2,
365 (char *)kmem_cache_alloc(ecryptfs_header_cache_2,
366 GFP_USER); 365 GFP_USER);
367 if (!page_virt) { 366 if (!page_virt) {
368 rc = -ENOMEM; 367 rc = -ENOMEM;
@@ -370,7 +369,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
370 "Cannot ecryptfs_kmalloc a page\n"); 369 "Cannot ecryptfs_kmalloc a page\n");
371 goto out_dput; 370 goto out_dput;
372 } 371 }
373 memset(page_virt, 0, PAGE_CACHE_SIZE); 372
374 rc = ecryptfs_read_header_region(page_virt, lower_dentry, nd->mnt); 373 rc = ecryptfs_read_header_region(page_virt, lower_dentry, nd->mnt);
375 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; 374 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat;
376 if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED)) 375 if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED))
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 745c0f1bfbbd..80bccd5ff8e6 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -207,14 +207,12 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
207 /* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or 207 /* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or
208 * at end of function upon failure */ 208 * at end of function upon failure */
209 auth_tok_list_item = 209 auth_tok_list_item =
210 kmem_cache_alloc(ecryptfs_auth_tok_list_item_cache, GFP_KERNEL); 210 kmem_cache_zalloc(ecryptfs_auth_tok_list_item_cache, GFP_KERNEL);
211 if (!auth_tok_list_item) { 211 if (!auth_tok_list_item) {
212 ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n"); 212 ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n");
213 rc = -ENOMEM; 213 rc = -ENOMEM;
214 goto out; 214 goto out;
215 } 215 }
216 memset(auth_tok_list_item, 0,
217 sizeof(struct ecryptfs_auth_tok_list_item));
218 (*new_auth_tok) = &auth_tok_list_item->auth_tok; 216 (*new_auth_tok) = &auth_tok_list_item->auth_tok;
219 217
220 /* check for body size - one to two bytes */ 218 /* check for body size - one to two bytes */
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index d0541ae8faba..fe41ab1566ee 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -378,15 +378,13 @@ ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
378 378
379 /* Released in ecryptfs_put_super() */ 379 /* Released in ecryptfs_put_super() */
380 ecryptfs_set_superblock_private(sb, 380 ecryptfs_set_superblock_private(sb,
381 kmem_cache_alloc(ecryptfs_sb_info_cache, 381 kmem_cache_zalloc(ecryptfs_sb_info_cache,
382 GFP_KERNEL)); 382 GFP_KERNEL));
383 if (!ecryptfs_superblock_to_private(sb)) { 383 if (!ecryptfs_superblock_to_private(sb)) {
384 ecryptfs_printk(KERN_WARNING, "Out of memory\n"); 384 ecryptfs_printk(KERN_WARNING, "Out of memory\n");
385 rc = -ENOMEM; 385 rc = -ENOMEM;
386 goto out; 386 goto out;
387 } 387 }
388 memset(ecryptfs_superblock_to_private(sb), 0,
389 sizeof(struct ecryptfs_sb_info));
390 sb->s_op = &ecryptfs_sops; 388 sb->s_op = &ecryptfs_sops;
391 /* Released through deactivate_super(sb) from get_sb_nodev */ 389 /* Released through deactivate_super(sb) from get_sb_nodev */
392 sb->s_root = d_alloc(NULL, &(const struct qstr) { 390 sb->s_root = d_alloc(NULL, &(const struct qstr) {
@@ -402,7 +400,7 @@ ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
402 /* Released in d_release when dput(sb->s_root) is called */ 400 /* Released in d_release when dput(sb->s_root) is called */
403 /* through deactivate_super(sb) from get_sb_nodev() */ 401 /* through deactivate_super(sb) from get_sb_nodev() */
404 ecryptfs_set_dentry_private(sb->s_root, 402 ecryptfs_set_dentry_private(sb->s_root,
405 kmem_cache_alloc(ecryptfs_dentry_info_cache, 403 kmem_cache_zalloc(ecryptfs_dentry_info_cache,
406 GFP_KERNEL)); 404 GFP_KERNEL));
407 if (!ecryptfs_dentry_to_private(sb->s_root)) { 405 if (!ecryptfs_dentry_to_private(sb->s_root)) {
408 ecryptfs_printk(KERN_ERR, 406 ecryptfs_printk(KERN_ERR,
@@ -410,8 +408,6 @@ ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
410 rc = -ENOMEM; 408 rc = -ENOMEM;
411 goto out; 409 goto out;
412 } 410 }
413 memset(ecryptfs_dentry_to_private(sb->s_root), 0,
414 sizeof(struct ecryptfs_dentry_info));
415 rc = 0; 411 rc = 0;
416out: 412out:
417 /* Should be able to rely on deactivate_super called from 413 /* Should be able to rely on deactivate_super called from
diff --git a/fs/exec.c b/fs/exec.c
index 11fe93f7363c..7e36c6f6f538 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -405,12 +405,10 @@ int setup_arg_pages(struct linux_binprm *bprm,
405 bprm->loader += stack_base; 405 bprm->loader += stack_base;
406 bprm->exec += stack_base; 406 bprm->exec += stack_base;
407 407
408 mpnt = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 408 mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
409 if (!mpnt) 409 if (!mpnt)
410 return -ENOMEM; 410 return -ENOMEM;
411 411
412 memset(mpnt, 0, sizeof(*mpnt));
413
414 down_write(&mm->mmap_sem); 412 down_write(&mm->mmap_sem);
415 { 413 {
416 mpnt->vm_mm = mm; 414 mpnt->vm_mm = mm;
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 0e34d9918973..e62d4f620c58 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -282,8 +282,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
282 return; 282 return;
283 } 283 }
284 284
285 bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL), 285 bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL),
286 memset(bd, 0, sizeof(struct gfs2_bufdata));
287 bd->bd_bh = bh; 286 bd->bd_bh = bh;
288 bd->bd_gl = gl; 287 bd->bd_gl = gl;
289 288
diff --git a/fs/namespace.c b/fs/namespace.c
index 5ef336c1103c..fd999cab7b57 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -53,9 +53,8 @@ static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
53 53
54struct vfsmount *alloc_vfsmnt(const char *name) 54struct vfsmount *alloc_vfsmnt(const char *name)
55{ 55{
56 struct vfsmount *mnt = kmem_cache_alloc(mnt_cache, GFP_KERNEL); 56 struct vfsmount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
57 if (mnt) { 57 if (mnt) {
58 memset(mnt, 0, sizeof(struct vfsmount));
59 atomic_set(&mnt->mnt_count, 1); 58 atomic_set(&mnt->mnt_count, 1);
60 INIT_LIST_HEAD(&mnt->mnt_hash); 59 INIT_LIST_HEAD(&mnt->mnt_hash);
61 INIT_LIST_HEAD(&mnt->mnt_child); 60 INIT_LIST_HEAD(&mnt->mnt_child);
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index a4bcae8a9aff..42261dbdf60f 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -61,7 +61,7 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server,
61 struct smb_request *req; 61 struct smb_request *req;
62 unsigned char *buf = NULL; 62 unsigned char *buf = NULL;
63 63
64 req = kmem_cache_alloc(req_cachep, GFP_KERNEL); 64 req = kmem_cache_zalloc(req_cachep, GFP_KERNEL);
65 VERBOSE("allocating request: %p\n", req); 65 VERBOSE("allocating request: %p\n", req);
66 if (!req) 66 if (!req)
67 goto out; 67 goto out;
@@ -74,7 +74,6 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server,
74 } 74 }
75 } 75 }
76 76
77 memset(req, 0, sizeof(struct smb_request));
78 req->rq_buffer = buf; 77 req->rq_buffer = buf;
79 req->rq_bufsize = bufsize; 78 req->rq_bufsize = bufsize;
80 req->rq_server = server; 79 req->rq_server = server;
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 9dcdf556c99c..9e95e7abaf69 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -37,11 +37,10 @@ static struct sysfs_dirent * __sysfs_new_dirent(void * element)
37{ 37{
38 struct sysfs_dirent * sd; 38 struct sysfs_dirent * sd;
39 39
40 sd = kmem_cache_alloc(sysfs_dir_cachep, GFP_KERNEL); 40 sd = kmem_cache_zalloc(sysfs_dir_cachep, GFP_KERNEL);
41 if (!sd) 41 if (!sd)
42 return NULL; 42 return NULL;
43 43
44 memset(sd, 0, sizeof(*sd));
45 atomic_set(&sd->s_count, 1); 44 atomic_set(&sd->s_count, 1);
46 atomic_set(&sd->s_event, 1); 45 atomic_set(&sd->s_event, 1);
47 INIT_LIST_HEAD(&sd->s_children); 46 INIT_LIST_HEAD(&sd->s_children);
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 0c775fceb675..0689e004a281 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -558,10 +558,9 @@ struct sas_task {
558static inline struct sas_task *sas_alloc_task(gfp_t flags) 558static inline struct sas_task *sas_alloc_task(gfp_t flags)
559{ 559{
560 extern struct kmem_cache *sas_task_cache; 560 extern struct kmem_cache *sas_task_cache;
561 struct sas_task *task = kmem_cache_alloc(sas_task_cache, flags); 561 struct sas_task *task = kmem_cache_zalloc(sas_task_cache, flags);
562 562
563 if (task) { 563 if (task) {
564 memset(task, 0, sizeof(*task));
565 INIT_LIST_HEAD(&task->list); 564 INIT_LIST_HEAD(&task->list);
566 spin_lock_init(&task->task_state_lock); 565 spin_lock_init(&task->task_state_lock);
567 task->task_state_flags = SAS_TASK_STATE_PENDING; 566 task->task_state_flags = SAS_TASK_STATE_PENDING;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 5fe87de10ff0..a1bf61617839 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -399,10 +399,9 @@ EXPORT_SYMBOL_GPL(register_posix_clock);
399static struct k_itimer * alloc_posix_timer(void) 399static struct k_itimer * alloc_posix_timer(void)
400{ 400{
401 struct k_itimer *tmr; 401 struct k_itimer *tmr;
402 tmr = kmem_cache_alloc(posix_timers_cache, GFP_KERNEL); 402 tmr = kmem_cache_zalloc(posix_timers_cache, GFP_KERNEL);
403 if (!tmr) 403 if (!tmr)
404 return tmr; 404 return tmr;
405 memset(tmr, 0, sizeof (struct k_itimer));
406 if (unlikely(!(tmr->sigq = sigqueue_alloc()))) { 405 if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {
407 kmem_cache_free(posix_timers_cache, tmr); 406 kmem_cache_free(posix_timers_cache, tmr);
408 tmr = NULL; 407 tmr = NULL;
diff --git a/net/core/dst.c b/net/core/dst.c
index 1a53fb39b7e0..f9eace78d354 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -132,10 +132,9 @@ void * dst_alloc(struct dst_ops * ops)
132 if (ops->gc()) 132 if (ops->gc())
133 return NULL; 133 return NULL;
134 } 134 }
135 dst = kmem_cache_alloc(ops->kmem_cachep, GFP_ATOMIC); 135 dst = kmem_cache_zalloc(ops->kmem_cachep, GFP_ATOMIC);
136 if (!dst) 136 if (!dst)
137 return NULL; 137 return NULL;
138 memset(dst, 0, ops->entry_size);
139 atomic_set(&dst->__refcnt, 0); 138 atomic_set(&dst->__refcnt, 0);
140 dst->ops = ops; 139 dst->ops = ops;
141 dst->lastuse = jiffies; 140 dst->lastuse = jiffies;
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 054d46493d2b..efb673ad1854 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -251,12 +251,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl)
251 goto out_entries; 251 goto out_entries;
252 } 252 }
253 253
254 n = kmem_cache_alloc(tbl->kmem_cachep, GFP_ATOMIC); 254 n = kmem_cache_zalloc(tbl->kmem_cachep, GFP_ATOMIC);
255 if (!n) 255 if (!n)
256 goto out_entries; 256 goto out_entries;
257 257
258 memset(n, 0, tbl->entry_size);
259
260 skb_queue_head_init(&n->arp_queue); 258 skb_queue_head_init(&n->arp_queue);
261 rwlock_init(&n->lock); 259 rwlock_init(&n->lock);
262 n->updated = n->used = now; 260 n->updated = n->used = now;
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c
index c1f0cc1b1c60..720501e1ae20 100644
--- a/net/decnet/dn_table.c
+++ b/net/decnet/dn_table.c
@@ -593,12 +593,10 @@ create:
593 593
594replace: 594replace:
595 err = -ENOBUFS; 595 err = -ENOBUFS;
596 new_f = kmem_cache_alloc(dn_hash_kmem, GFP_KERNEL); 596 new_f = kmem_cache_zalloc(dn_hash_kmem, GFP_KERNEL);
597 if (new_f == NULL) 597 if (new_f == NULL)
598 goto out; 598 goto out;
599 599
600 memset(new_f, 0, sizeof(struct dn_fib_node));
601
602 new_f->fn_key = key; 600 new_f->fn_key = key;
603 new_f->fn_type = type; 601 new_f->fn_type = type;
604 new_f->fn_scope = r->rtm_scope; 602 new_f->fn_scope = r->rtm_scope;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index ecb5422ea237..d7e1e60f51d5 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -479,20 +479,18 @@ static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
479 */ 479 */
480static struct mfc_cache *ipmr_cache_alloc(void) 480static struct mfc_cache *ipmr_cache_alloc(void)
481{ 481{
482 struct mfc_cache *c=kmem_cache_alloc(mrt_cachep, GFP_KERNEL); 482 struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
483 if(c==NULL) 483 if(c==NULL)
484 return NULL; 484 return NULL;
485 memset(c, 0, sizeof(*c));
486 c->mfc_un.res.minvif = MAXVIFS; 485 c->mfc_un.res.minvif = MAXVIFS;
487 return c; 486 return c;
488} 487}
489 488
490static struct mfc_cache *ipmr_cache_alloc_unres(void) 489static struct mfc_cache *ipmr_cache_alloc_unres(void)
491{ 490{
492 struct mfc_cache *c=kmem_cache_alloc(mrt_cachep, GFP_ATOMIC); 491 struct mfc_cache *c=kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC);
493 if(c==NULL) 492 if(c==NULL)
494 return NULL; 493 return NULL;
495 memset(c, 0, sizeof(*c));
496 skb_queue_head_init(&c->mfc_un.unres.unresolved); 494 skb_queue_head_init(&c->mfc_un.unres.unresolved);
497 c->mfc_un.unres.expires = jiffies + 10*HZ; 495 c->mfc_un.unres.expires = jiffies + 10*HZ;
498 return c; 496 return c;
diff --git a/net/ipv4/ipvs/ip_vs_conn.c b/net/ipv4/ipvs/ip_vs_conn.c
index 8086787a2c51..3aec4ac66e3c 100644
--- a/net/ipv4/ipvs/ip_vs_conn.c
+++ b/net/ipv4/ipvs/ip_vs_conn.c
@@ -603,13 +603,12 @@ ip_vs_conn_new(int proto, __be32 caddr, __be16 cport, __be32 vaddr, __be16 vport
603 struct ip_vs_conn *cp; 603 struct ip_vs_conn *cp;
604 struct ip_vs_protocol *pp = ip_vs_proto_get(proto); 604 struct ip_vs_protocol *pp = ip_vs_proto_get(proto);
605 605
606 cp = kmem_cache_alloc(ip_vs_conn_cachep, GFP_ATOMIC); 606 cp = kmem_cache_zalloc(ip_vs_conn_cachep, GFP_ATOMIC);
607 if (cp == NULL) { 607 if (cp == NULL) {
608 IP_VS_ERR_RL("ip_vs_conn_new: no memory available.\n"); 608 IP_VS_ERR_RL("ip_vs_conn_new: no memory available.\n");
609 return NULL; 609 return NULL;
610 } 610 }
611 611
612 memset(cp, 0, sizeof(*cp));
613 INIT_LIST_HEAD(&cp->c_list); 612 INIT_LIST_HEAD(&cp->c_list);
614 init_timer(&cp->timer); 613 init_timer(&cp->timer);
615 cp->timer.data = (unsigned long)cp; 614 cp->timer.data = (unsigned long)cp;
diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c
index 8556a4f4f60a..62be2eb37698 100644
--- a/net/ipv4/netfilter/ip_conntrack_core.c
+++ b/net/ipv4/netfilter/ip_conntrack_core.c
@@ -638,14 +638,13 @@ struct ip_conntrack *ip_conntrack_alloc(struct ip_conntrack_tuple *orig,
638 } 638 }
639 } 639 }
640 640
641 conntrack = kmem_cache_alloc(ip_conntrack_cachep, GFP_ATOMIC); 641 conntrack = kmem_cache_zalloc(ip_conntrack_cachep, GFP_ATOMIC);
642 if (!conntrack) { 642 if (!conntrack) {
643 DEBUGP("Can't allocate conntrack.\n"); 643 DEBUGP("Can't allocate conntrack.\n");
644 atomic_dec(&ip_conntrack_count); 644 atomic_dec(&ip_conntrack_count);
645 return ERR_PTR(-ENOMEM); 645 return ERR_PTR(-ENOMEM);
646 } 646 }
647 647
648 memset(conntrack, 0, sizeof(*conntrack));
649 atomic_set(&conntrack->ct_general.use, 1); 648 atomic_set(&conntrack->ct_general.use, 1);
650 conntrack->ct_general.destroy = destroy_conntrack; 649 conntrack->ct_general.destroy = destroy_conntrack;
651 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig; 650 conntrack->tuplehash[IP_CT_DIR_ORIGINAL].tuple = *orig;
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 96d8310ae9c8..827f8842b578 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -150,8 +150,7 @@ static __inline__ struct fib6_node * node_alloc(void)
150{ 150{
151 struct fib6_node *fn; 151 struct fib6_node *fn;
152 152
153 if ((fn = kmem_cache_alloc(fib6_node_kmem, GFP_ATOMIC)) != NULL) 153 fn = kmem_cache_zalloc(fib6_node_kmem, GFP_ATOMIC);
154 memset(fn, 0, sizeof(struct fib6_node));
155 154
156 return fn; 155 return fn;
157} 156}
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 0b1ddb1005ac..783481860174 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -979,11 +979,10 @@ struct sctp_chunk *sctp_chunkify(struct sk_buff *skb,
979{ 979{
980 struct sctp_chunk *retval; 980 struct sctp_chunk *retval;
981 981
982 retval = kmem_cache_alloc(sctp_chunk_cachep, GFP_ATOMIC); 982 retval = kmem_cache_zalloc(sctp_chunk_cachep, GFP_ATOMIC);
983 983
984 if (!retval) 984 if (!retval)
985 goto nodata; 985 goto nodata;
986 memset(retval, 0, sizeof(struct sctp_chunk));
987 986
988 if (!sk) { 987 if (!sk) {
989 SCTP_DEBUG_PRINTK("chunkifying skb %p w/o an sk\n", skb); 988 SCTP_DEBUG_PRINTK("chunkifying skb %p w/o an sk\n", skb);
diff --git a/security/selinux/avc.c b/security/selinux/avc.c
index e7c0b5e2066b..da8caf10ef97 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 65fb5e8ea941..9eeab82719a2 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;
diff --git a/security/selinux/ss/avtab.c b/security/selinux/ss/avtab.c
index ebb993c5c244..9142073319c0 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) {