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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 18 Jul 2008 14:04:27 +0900
From:	Magnus Damm <magnus.damm@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Magnus Damm <magnus.damm@...il.com>, hjk@...utronix.de,
	gregkh@...e.de, akpm@...ux-foundation.org
Subject: [PATCH 03/06] uio: Remove vma->vm_private_data from uio_find_mem()

From: Magnus Damm <damm@...l.co.jp>

Pass along a struct uio_device pointer to uio_find_mem() so we can
remove the vma->vm_private_data usage. This allows us to store
different data in vma->vm_private_data in the future.

Signed-off-by: Magnus Damm <damm@...l.co.jp>
---

 drivers/uio/uio.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- 0003/drivers/uio/uio.c
+++ work/drivers/uio/uio.c	2008-07-18 12:42:21.000000000 +0900
@@ -427,10 +427,10 @@ static ssize_t uio_read(struct file *fil
 	return retval;
 }
 
-static struct uio_mem *uio_find_mem(struct vm_area_struct *vma)
+static struct uio_mem *uio_find_mem(struct uio_device *idev,
+				    struct vm_area_struct *vma)
 {
 	int mi;
-	struct uio_device *idev = vma->vm_private_data;
 
 	for (mi = 0; mi < MAX_UIO_MAPS; mi++) {
 		if (idev->info->mem[mi].size == 0)
@@ -456,7 +456,7 @@ static void uio_vma_close(struct vm_area
 static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 {
 	struct uio_device *idev = vma->vm_private_data;
-	struct uio_mem *imem = uio_find_mem(vma);
+	struct uio_mem *imem = uio_find_mem(idev, vma);
 	struct page *page;
 
 	if (!imem)
@@ -507,9 +507,7 @@ static int uio_mmap(struct file *filep, 
 	if (vma->vm_end < vma->vm_start)
 		return -EINVAL;
 
-	vma->vm_private_data = idev;
-
-	imem = uio_find_mem(vma);
+	imem = uio_find_mem(idev, vma);
 	if (!imem)
 		return -EINVAL;
 
@@ -523,6 +521,8 @@ static int uio_mmap(struct file *filep, 
 		return ret;
 	}
 
+	vma->vm_private_data = idev;
+
 	switch (imem->memtype) {
 		case UIO_MEM_PHYS:
 			return uio_mmap_physical(vma, imem);
--
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