projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
284f52a
)
char: mspec: Use kvzalloc() in mspec_mmap()
author
Denis Efremov
<efremov@linux.com>
Thu, 27 Aug 2020 21:34:21 +0000
(
00:34
+0300)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Fri, 28 Aug 2020 10:10:04 +0000
(12:10 +0200)
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>
drivers/char/mspec.c
patch
|
blob
|
history
diff --git
a/drivers/char/mspec.c
b/drivers/char/mspec.c
index 0fae33319d2edac441bdc6048fb6a751376825b7..f8231e2e84beccec68c0440e7068907aee261a42 100644
(file)
--- 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;