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:   Fri, 27 Jan 2017 10:47:24 +0800
From:   Wei Yang <richard.weiyang@...il.com>
To:     tglx@...utronix.de, mingo@...hat.com, hpa@...or.com
Cc:     x86@...nel.org, linux-kernel@...r.kernel.org,
        Wei Yang <richard.weiyang@...il.com>
Subject: [Resend PATCH] x86/e820: break the loop when the region is less then current region

e820_all_mapped() iterates the e820 table to check whether a region is
mapped or not. Since the e820 table is sorted, when the region is less than
the current region, no need to continue the iteration.

The patch breaks the loop accordingly.

Signed-off-by: Wei Yang <richard.weiyang@...il.com>
---
 arch/x86/kernel/e820.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 90e8dde..f4fb197 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -86,10 +86,16 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
 	for (i = 0; i < e820->nr_map; i++) {
 		struct e820entry *ei = &e820->map[i];
 
+		/* Since the e820 table is sorted, when the region is less
+		 * than the current region, break it.
+		 */
+		if (ei->addr >= end)
+			break;
+
 		if (type && ei->type != type)
 			continue;
 		/* is the region (part) in overlap with the current region ?*/
-		if (ei->addr >= end || ei->addr + ei->size <= start)
+		if (ei->addr + ei->size <= start)
 			continue;
 
 		/* if the region is at the beginning of <start,end> we move
-- 
2.5.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ