Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Denis Efremov and committed by
Greg Kroah-Hartman
fe69795e 284f52ac

+1 -4
+1 -4
drivers/char/mspec.c
··· 195 195 196 196 pages = vma_pages(vma); 197 197 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); 202 199 if (!vdata) 203 200 return -ENOMEM; 204 201