Commit 658c74cf authored by Rakib Mullick's avatar Rakib Mullick Committed by Linus Torvalds

drivers/char/mspec.c: use {k,v}zalloc to allocate memory

Let memory allocator initialize the allocated memory as null, thus remove
the use of memset.
Signed-off-by: default avatarRakib Mullick <rakib.mullick@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 07412736
...@@ -271,14 +271,13 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, ...@@ -271,14 +271,13 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
vdata_size = sizeof(struct vma_data) + pages * sizeof(long); vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
if (vdata_size <= PAGE_SIZE) if (vdata_size <= PAGE_SIZE)
vdata = kmalloc(vdata_size, GFP_KERNEL); vdata = kzalloc(vdata_size, GFP_KERNEL);
else { else {
vdata = vmalloc(vdata_size); vdata = vzalloc(vdata_size);
flags = VMD_VMALLOCED; flags = VMD_VMALLOCED;
} }
if (!vdata) if (!vdata)
return -ENOMEM; return -ENOMEM;
memset(vdata, 0, vdata_size);
vdata->vm_start = vma->vm_start; vdata->vm_start = vma->vm_start;
vdata->vm_end = vma->vm_end; vdata->vm_end = vma->vm_end;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment