Commit 658c74cf3c98b1c9bc21e26731052db66251dfd8
Committed by
Linus Torvalds
1 parent
074127367a
Exists in
master
and in
20 other branches
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: Rakib Mullick <rakib.mullick@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 2 additions and 3 deletions Side-by-side Diff
drivers/char/mspec.c
... | ... | @@ -271,14 +271,13 @@ |
271 | 271 | pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
272 | 272 | vdata_size = sizeof(struct vma_data) + pages * sizeof(long); |
273 | 273 | if (vdata_size <= PAGE_SIZE) |
274 | - vdata = kmalloc(vdata_size, GFP_KERNEL); | |
274 | + vdata = kzalloc(vdata_size, GFP_KERNEL); | |
275 | 275 | else { |
276 | - vdata = vmalloc(vdata_size); | |
276 | + vdata = vzalloc(vdata_size); | |
277 | 277 | flags = VMD_VMALLOCED; |
278 | 278 | } |
279 | 279 | if (!vdata) |
280 | 280 | return -ENOMEM; |
281 | - memset(vdata, 0, vdata_size); | |
282 | 281 | |
283 | 282 | vdata->vm_start = vma->vm_start; |
284 | 283 | vdata->vm_end = vma->vm_end; |