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]
Message-ID: <20090213145241.GC13000@alberich.amd.com>
Date:	Fri, 13 Feb 2009 15:52:41 +0100
From:	Andreas Herrmann <andreas.herrmann3@....com>
To:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>
CC:	linux-kernel@...r.kernel.org
Subject: [PATCH 3/7] x86: memtest: cleanup memtest function

Impact: code cleanup

Signed-off-by: Andreas Herrmann <andreas.herrmann3@....com>
---
 arch/x86/mm/memtest.c |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
index a8a6c51..82321d9 100644
--- a/arch/x86/mm/memtest.c
+++ b/arch/x86/mm/memtest.c
@@ -21,6 +21,15 @@ static unsigned long patterns[] = {
 #endif
 };
 
+static void reserve_bad_mem(unsigned long pattern, unsigned long start_bad,
+			    unsigned long end_bad)
+{
+	printk(KERN_CONT "\n  %016lx bad mem addr "
+	       "%010lx - %010lx reserved",
+	       pattern, start_bad, end_bad);
+	reserve_early(start_bad, end_bad, "BAD RAM");
+}
+
 static void __init memtest(unsigned long start_phys, unsigned long size,
 			   unsigned long pattern)
 {
@@ -42,25 +51,18 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
 	for (i = 0; i < count; i++)
 		start[i] = pattern;
 	for (i = 0; i < count; i++, start++, start_phys_aligned += incr) {
-		if (*start != pattern) {
-			if (start_phys_aligned == last_bad + incr) {
-				last_bad += incr;
-			} else {
-				if (start_bad) {
-					printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
-					       pattern, start_bad,
-					       last_bad + incr);
-					reserve_early(start_bad, last_bad + incr, "BAD RAM");
-				}
-				start_bad = last_bad = start_phys_aligned;
-			}
+		if (*start == pattern)
+			continue;
+		if (start_phys_aligned == last_bad + incr) {
+			last_bad += incr;
+			continue;
 		}
+		if (start_bad)
+			reserve_bad_mem(pattern, start_bad, last_bad + incr);
+		start_bad = last_bad = start_phys_aligned;
 	}
-	if (start_bad) {
-		printk(KERN_CONT "\n  %016lx bad mem addr %010lx - %010lx reserved",
-		       pattern, start_bad, last_bad + incr);
-		reserve_early(start_bad, last_bad + incr, "BAD RAM");
-	}
+	if (start_bad)
+		reserve_bad_mem(pattern, start_bad, last_bad + incr);
 }
 
 /* default is disabled */
-- 
1.6.1.2



--
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