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: <20190614060143.17867-1-richardw.yang@linux.intel.com>
Date:   Fri, 14 Jun 2019 14:01:43 +0800
From:   Wei Yang <richardw.yang@...ux.intel.com>
To:     linux-kernel@...r.kernel.org
Cc:     akpm@...ux-foundation.org, dan.j.williams@...el.com,
        jglisse@...hat.com, dave.jiang@...el.com, osalvador@...e.com,
        mhocko@...e.com, Wei Yang <richardw.yang@...ux.intel.com>
Subject: [PATCH] kernel/memremap.c: use ALIGN/ALIGN_DOWN to calculate align_start/end

The purpose of align_start/end is to expand to SECTION boundary. Use
ALIGN/ALIGN_DOWN directly is more self-explain and clean.

Signed-off-by: Wei Yang <richardw.yang@...ux.intel.com>
---
 kernel/memremap.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/memremap.c b/kernel/memremap.c
index 1490e63f69a9..53cf751f0721 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -159,10 +159,9 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
 	if (!pgmap->ref || !pgmap->kill)
 		return ERR_PTR(-EINVAL);
 
-	align_start = res->start & ~(SECTION_SIZE - 1);
-	align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
-		- align_start;
-	align_end = align_start + align_size - 1;
+	align_start = ALIGN_DOWN(res->start, SECTION_SIZE);
+	align_end = ALIGN(res->end, SECTION_SIZE) - 1;
+	align_size = align_end - align_start + 1;
 
 	conflict_pgmap = get_dev_pagemap(PHYS_PFN(align_start), NULL);
 	if (conflict_pgmap) {
-- 
2.19.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ