summaryrefslogtreecommitdiff
path: root/drivers/char/mspec.c
diff options
context:
space:
mode:
authorDenis Efremov <efremov@linux.com>2020-08-28 00:34:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-08-28 13:10:04 +0300
commitfe69795e84a553b838504e0acdb4a57c3fbdd200 (patch)
treef026e35fbc61776b6295d08cc53e63b85e5bde63 /drivers/char/mspec.c
parent284f52ac1c6cfa1b2e5c11b84653dd90e4e91de7 (diff)
downloadlinux-fe69795e84a553b838504e0acdb4a57c3fbdd200.tar.xz
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>
Diffstat (limited to 'drivers/char/mspec.c')
-rw-r--r--drivers/char/mspec.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index 0fae33319d2e..f8231e2e84be 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -195,10 +195,7 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
pages = vma_pages(vma);
vdata_size = sizeof(struct vma_data) + pages * sizeof(long);
- if (vdata_size <= PAGE_SIZE)
- vdata = kzalloc(vdata_size, GFP_KERNEL);
- else
- vdata = vzalloc(vdata_size);
+ vdata = kvzalloc(vdata_size, GFP_KERNEL);
if (!vdata)
return -ENOMEM;