⬢ DragonFlyBSD Kernel Audit
DF-5340 / fix.diff
← back to finding ↓ download raw
--- a/sys/platform/pc64/x86_64/mptable.c	2026-10-03 04:37:03.595609252 +0000
+++ b/sys/platform/pc64/x86_64/mptable.c	2026-10-03 04:37:03.627608844 +0000
@@ -279,8 +279,13 @@
 		target = (u_int32_t)ebda_addr;
 		if ((x = mptable_search_sig(target, 1024 / 4)) > 0)
 			return x;
-	} else {
-		/* last 1K of base memory, effective 'top of base' passed in */
+	} else if (base_memory > 1) {
+		/*
+		 * Last 1K of base memory, effective 'top of base' passed
+		 * in.  Degenerate base_memory (0/1 KB) would underflow
+		 * (base_memory - 1) * 1024 to 0xFFFFFC00 or trip the
+		 * target != 0 assertion; skip the scan instead.
+		 */
 		target = (u_int32_t)((base_memory - 1) * 1024);
 		if ((x = mptable_search_sig(target, 1024 / 4)) > 0)
 			return x;