diff options
-rw-r--r-- | drivers/char/mspec.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c index 966a95bc974b..25d139c9dbed 100644 --- a/drivers/char/mspec.c +++ b/drivers/char/mspec.c | |||
@@ -271,14 +271,13 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, | |||
271 | pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; | 271 | pages = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
272 | vdata_size = sizeof(struct vma_data) + pages * sizeof(long); | 272 | vdata_size = sizeof(struct vma_data) + pages * sizeof(long); |
273 | if (vdata_size <= PAGE_SIZE) | 273 | if (vdata_size <= PAGE_SIZE) |
274 | vdata = kmalloc(vdata_size, GFP_KERNEL); | 274 | vdata = kzalloc(vdata_size, GFP_KERNEL); |
275 | else { | 275 | else { |
276 | vdata = vmalloc(vdata_size); | 276 | vdata = vzalloc(vdata_size); |
277 | flags = VMD_VMALLOCED; | 277 | flags = VMD_VMALLOCED; |
278 | } | 278 | } |
279 | if (!vdata) | 279 | if (!vdata) |
280 | return -ENOMEM; | 280 | return -ENOMEM; |
281 | memset(vdata, 0, vdata_size); | ||
282 | 281 | ||
283 | vdata->vm_start = vma->vm_start; | 282 | vdata->vm_start = vma->vm_start; |
284 | vdata->vm_end = vma->vm_end; | 283 | vdata->vm_end = vma->vm_end; |