Skip to contentSkip to conversation

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

PATCH New Denis Efremov 1 participant 1 message Aug 27, 2020 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 char: mspec: Use kvzalloc() in mspec_mmap()

Use kvzalloc() in mspec_mmap() instead of open-coding it.

---
 drivers/char/mspec.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/char/mspec.c +1 -4
index 0fae33319d2e..f8231e2e84be 100644
@@ -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;
 
Signature · 1 line
2.26.2