Commit fe69795e authored by Denis Efremov's avatar Denis Efremov Committed by Greg Kroah-Hartman

char: mspec: Use kvzalloc() in mspec_mmap()

Use kvzalloc() in mspec_mmap() instead of open-coding it.
Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
Link: https://lore.kernel.org/r/20200827213421.50429-1-efremov@linux.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 284f52ac
...@@ -195,10 +195,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma, ...@@ -195,10 +195,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
pages = vma_pages(vma); pages = vma_pages(vma);
vdata_size = sizeof(struct vma_data) + pages * sizeof(long); vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
if (vdata_size <= PAGE_SIZE) vdata = kvzalloc(vdata_size, GFP_KERNEL);
vdata = kzalloc(vdata_size, GFP_KERNEL);
else
vdata = vzalloc(vdata_size);
if (!vdata) if (!vdata)
return -ENOMEM; return -ENOMEM;
......
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