Skip to contentSkip to conversation

x86: fix early_reserve_e820()

PATCH New Jan Beulich 1 participant 1 message May 6, 2009 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix early_reserve_e820()

Impact: bug fix

If the first non-reserved (sub-)range doesn't fit the size requested, an endless loop will be entered. If a range returned from find_e820_area_size() turns out insufficient in size, the range must be skipped before calling the function again.

---
 arch/x86/kernel/e820.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/x86/kernel/e820.c +6 -5
@@ -1074,12 +1074,13 @@ u64 __init early_reserve_e820(u64 startt
 	u64 addr;
 	u64 start;
 
-	start = startt;
-	while (size < sizet && (start + 1))
+	for (start = startt; ; start += size) {
 		start = find_e820_area_size(start, &size, align);
-
-	if (size < sizet)
-		return 0;
+		if (!(start + 1))
+			return 0;
+		if (size >= sizet)
+			break;
+	}
 
 #ifdef CONFIG_X86_32
 	if (start >= MAXMEM)