aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/kcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/kcore.c')
-rw-r--r--fs/proc/kcore.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 6a984f64edd7..3ceff3857272 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -279,12 +279,11 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
279 tsz = elf_buflen - *fpos; 279 tsz = elf_buflen - *fpos;
280 if (buflen < tsz) 280 if (buflen < tsz)
281 tsz = buflen; 281 tsz = buflen;
282 elf_buf = kmalloc(elf_buflen, GFP_ATOMIC); 282 elf_buf = kzalloc(elf_buflen, GFP_ATOMIC);
283 if (!elf_buf) { 283 if (!elf_buf) {
284 read_unlock(&kclist_lock); 284 read_unlock(&kclist_lock);
285 return -ENOMEM; 285 return -ENOMEM;
286 } 286 }
287 memset(elf_buf, 0, elf_buflen);
288 elf_kcore_store_hdr(elf_buf, nphdr, elf_buflen); 287 elf_kcore_store_hdr(elf_buf, nphdr, elf_buflen);
289 read_unlock(&kclist_lock); 288 read_unlock(&kclist_lock);
290 if (copy_to_user(buffer, elf_buf + *fpos, tsz)) { 289 if (copy_to_user(buffer, elf_buf + *fpos, tsz)) {
@@ -330,10 +329,9 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
330 unsigned long curstart = start; 329 unsigned long curstart = start;
331 unsigned long cursize = tsz; 330 unsigned long cursize = tsz;
332 331
333 elf_buf = kmalloc(tsz, GFP_KERNEL); 332 elf_buf = kzalloc(tsz, GFP_KERNEL);
334 if (!elf_buf) 333 if (!elf_buf)
335 return -ENOMEM; 334 return -ENOMEM;
336 memset(elf_buf, 0, tsz);
337 335
338 read_lock(&vmlist_lock); 336 read_lock(&vmlist_lock);
339 for (m=vmlist; m && cursize; m=m->next) { 337 for (m=vmlist; m && cursize; m=m->next) {