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]
Message-ID: <AANLkTim3jJi4ZMZHGztyS==wCJ5C-tLbRe99Qj0YnDe3@mail.gmail.com>
Date:	Sun, 27 Mar 2011 15:58:19 +0800
From:	Hillf Danton <dhillf@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: [PATCH] uio: fix finding mm index for vma

When finding mm index for vma it looks more flexible that the mm could
be sparse, and
both the size of mm and the pgoff of vma could give correct selection.

Signed-off-by: Hillf Danton <dhillf@...il.com>
---

--- a/drivers/uio/uio.c	2011-01-05 08:50:20.000000000 +0800
+++ b/drivers/uio/uio.c	2011-03-27 14:33:02.000000000 +0800
@@ -587,14 +587,12 @@ static ssize_t uio_write(struct file *fi

 static int uio_find_mem_index(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)
+	if (vma->vm_pgoff < MAX_UIO_MAPS) {
+		if (idev->info->mem[vma->vm_pgoff].size == 0)
 			return -1;
-		if (vma->vm_pgoff == mi)
-			return mi;
+		return (int)vma->vm_pgoff;
 	}
 	return -1;
 }
--
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