Skip to content

Commit fe69795

Browse files
evdenisgregkh
authored andcommitted
char: mspec: Use kvzalloc() in mspec_mmap()
Use kvzalloc() in mspec_mmap() instead of open-coding it. Signed-off-by: Denis Efremov <efremov@linux.com> Link: https://lore.kernel.org/r/20200827213421.50429-1-efremov@linux.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 284f52a commit fe69795

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎drivers/char/mspec.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
195195

196196
pages = vma_pages(vma);
197197
vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
198-
if (vdata_size <= PAGE_SIZE)
199-
vdata = kzalloc(vdata_size, GFP_KERNEL);
200-
else
201-
vdata = vzalloc(vdata_size);
198+
vdata = kvzalloc(vdata_size, GFP_KERNEL);
202199
if (!vdata)
203200
return -ENOMEM;
204201

0 commit comments

Comments
 (0)