--- a/sys/dev/raid/mps/mps_mapping.c +++ b/sys/dev/raid/mps/mps_mapping.c @@ -232,6 +232,12 @@ } 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 + * would touch mapping_table[max_devices] (one entry OOB). */ + if (*end_idx >= sc->max_devices) + *end_idx = sc->max_devices - 1; } /**