⬢ DragonFlyBSD Kernel Audit
DF-4093 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/raid/mpr/mpr_mapping.c	2026-09-17 23:11:08.935752656 +0000
+++ b/sys/dev/raid/mpr/mpr_mapping.c	2026-09-17 23:11:44.511296518 +0000
@@ -252,6 +252,13 @@
 	} else
 		*start_idx = sc->max_devices - sc->max_volumes;
 	*end_idx = *start_idx + sc->max_volumes - 1;
+	/* Keep the IR range inside the mapping table: with firmware facts
+	 * MaxTargets == 0 plus RESERVED_TARGETID_0 and low volume mapping,
+	 * start_idx + max_volumes - 1 == max_devices, and the `<=` IR walks
+	 * (:387, :430, :484, :2261, :2708) would touch
+	 * mapping_table[max_devices] - one entry OOB. */
+	if (*end_idx >= sc->max_devices)
+		*end_idx = sc->max_devices - 1;
 }
 
 /**