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: <51B44DF9.5040705@gmail.com>
Date:	Sun, 09 Jun 2013 17:42:17 +0800
From:	Shan Wei <shanwei88@...il.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	Samuel Liao <samuelliao@...cent.com>,
	Lin Feng <linfeng@...fujitsu.com>, hpa@...ux.intel.com,
	yinghai@...nel.org, Kernel-Maillist <linux-kernel@...r.kernel.org>
CC:	davidshan <davidshan@...cent.com>
Subject: [PATCH buf-fix] kernel, range: fix broken mtrr_cleanup

From: Samuel Liao <samuelliao@...cent.com>


commit fbe06b7bae7c9cf6ab05168fce5ee93b2f4bae7c broken the mtrr_cleanup
due to return incorrect merged range. this patch remove the empty range
by swapping with the last.

Error messages:
Jun  9 14:06:18 kernel: [    0.000000] *BAD*gran_size: 64K   chunk_size: 64K         num_reg: 4      lose cover RAM: -0G
Jun  9 14:06:18 kernel: [    0.000000] *BAD*gran_size: 64K   chunk_size: 128K        num_reg: 4      lose cover RAM: -0G
Jun  9 14:06:18 kernel: [    0.000000] *BAD*gran_size: 64K   chunk_size: 256K        num_reg: 4      lose cover RAM: -0G
Jun  9 14:06:18 kernel: [    0.000000] *BAD*gran_size: 64K   chunk_size: 512K        num_reg: 4      lose cover RAM: -0G


Signed-off-by: Samuel Liao <samuelliao@...cent.com>
---
 kernel/range.c | 15 ++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/kernel/range.c b/kernel/range.c
index eb911db..b723697 100644
--- a/kernel/range.c
+++ b/kernel/range.c
@@ -48,11 +48,18 @@ int add_range_with_merge(struct range *range, int az, int nr_range,
 		final_start = min(range[i].start, start);
 		final_end = max(range[i].end, end);
 
+		if (final_start == range[i].start && final_end == range[i].end)
+			return nr_range;
+
 		/* clear it and add it back for further merge */
-		range[i].start = 0;
-		range[i].end =  0;
-		return add_range_with_merge(range, az, nr_range,
-			final_start, final_end);
+		nr_range -= 1;
+		if (i != nr_range) {
+			range[i].start = range[nr_range].start;
+			range[i].end = range[nr_range].end;
+		}
+		range[nr_range].start = 0;
+		range[nr_range].end =  0;
+		i = -1;
 	}
 
 	/* Need to add it: */
-- 
1.8.2.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