lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 05 Feb 2015 14:52:42 +0900
From:	Cho KyongHo <pullip.cho@...sung.com>
To:	linux-media@...r.kernel.org, laurent.pinchart@...asonboard.com,
	linux-kernel@...r.kernel.org
Cc:	mchehab@....samsung.com, hans.verkuil@...co.com,
	laurent.pinchart@...asonboard.com
Subject: [PATCH] [media] v4l: vb2-memops: use vma slab when vma allocation

The slab for vm_area_struct which is vm_area_cachep is already prepared
for the general use. Instead of kmalloc() for the vma copy for userptr,
allocation from vm_area_cachep is more beneficial.

CC: Mauro Carvalho Chehab <mchehab@....samsung.com>
CC: Hans Verkuil <hans.verkuil@...co.com>
CC: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Signed-off-by: Cho KyongHo <pullip.cho@...sung.com>
---
 drivers/media/v4l2-core/videobuf2-memops.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/videobuf2-memops.c b/drivers/media/v4l2-core/videobuf2-memops.c
index 81c1ad8..dd06efa 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -37,7 +37,7 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
 {
 	struct vm_area_struct *vma_copy;
 
-	vma_copy = kmalloc(sizeof(*vma_copy), GFP_KERNEL);
+	vma_copy = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL);
 	if (vma_copy == NULL)
 		return NULL;
 
@@ -75,7 +75,7 @@ void vb2_put_vma(struct vm_area_struct *vma)
 	if (vma->vm_file)
 		fput(vma->vm_file);
 
-	kfree(vma);
+	kmem_cache_free(vm_area_cachep, vma);
 }
 EXPORT_SYMBOL_GPL(vb2_put_vma);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ