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: <200704241610.23342.eike-kernel@sf-tec.de>
Date:	Tue, 24 Apr 2007 16:10:22 +0200
From:	Rolf Eike Beer <eike-kernel@...tec.de>
To:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...l.org>
Subject: [PATCH] MM: use DIV_ROUND_UP() in mm/memory.c

This should make no difference in behaviour.

Signed-off-by: Rolf Eike Beer <eike-kernel@...tec.de>

---
commit 64aa7c3136258d3abc76354b5f83b9a9575169c0
tree 8037adc04b57cd6150456399b7caccf99489385a
parent bf0bd376f79cadb4f8cd454db1723eb9be0aabc1
author Rolf Eike Beer <eike-kernel@...tec.de> Tue, 24 Apr 2007 16:05:40 +0200
committer Rolf Eike Beer <eike-kernel@...tec.de> Tue, 24 Apr 2007 16:05:40 
+0200

 mm/memory.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index e7066e7..45bba1f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1838,12 +1838,11 @@ void unmap_mapping_range(struct address_space 
*mapping,
 {
 	struct zap_details details;
 	pgoff_t hba = holebegin >> PAGE_SHIFT;
-	pgoff_t hlen = (holelen + PAGE_SIZE - 1) >> PAGE_SHIFT;
+	pgoff_t hlen = DIV_ROUND_UP(holelen, PAGE_SIZE);
 
 	/* Check for overflow. */
 	if (sizeof(holelen) > sizeof(hlen)) {
-		long long holeend =
-			(holebegin + holelen + PAGE_SIZE - 1) >> PAGE_SHIFT;
+		long long holeend = DIV_ROUND_UP(holebegin + holelen, PAGE_SIZE);
 		if (holeend & ~(long long)ULONG_MAX)
 			hlen = ULONG_MAX - hba + 1;
 	}
@@ -2592,7 +2591,7 @@ int make_pages_present(unsigned long addr, unsigned long 
end)
 	write = (vma->vm_flags & VM_WRITE) != 0;
 	BUG_ON(addr >= end);
 	BUG_ON(end > vma->vm_end);
-	len = (end+PAGE_SIZE-1)/PAGE_SIZE-addr/PAGE_SIZE;
+	len = DIV_ROUND_UP(end, PAGE_SIZE) - addr/PAGE_SIZE;
 	ret = get_user_pages(current, current->mm, addr,
 			len, write, 0, NULL, NULL);
 	if (ret < 0)
-
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