⬢ DragonFlyBSD Kernel Audit
DF-4088 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/raid/mps/mps_mapping.c
+++ b/sys/dev/raid/mps/mps_mapping.c
@@ -806,6 +806,7 @@
 		    mt_entry++)
 			mt_entry->device_info  &= ~MPS_DEV_RESERVED;
 		found_space = 0;
+		num_found = 0;
 		for (map_idx = (max_num_phy_ids +
 		    skip_count); map_idx < end_of_table; map_idx++) {
 			mt_entry = &sc->mapping_table[map_idx];
@@ -827,7 +828,7 @@
 			for (enc_idx = 0; enc_idx < sc->num_enc_table_entries;
 			    enc_idx++, enc_entry++) {
 				if (map_idx < enc_entry->start_index ||
-				    map_idx > (enc_entry->start_index +
+				    map_idx >= (enc_entry->start_index +
 				    enc_entry->num_slots))
 					continue;
 				if (!enc_entry->removal_flag) {
@@ -844,7 +845,7 @@
 				}
 				if (map_idx == (enc_entry->start_index +
 				    enc_entry->num_slots - 1))
-					_mapping_clear_enc_entry(et_entry);
+					_mapping_clear_enc_entry(enc_entry);
 			}
 		}
 		enc_entry = sc->enclosure_table;
@@ -859,7 +860,7 @@
 				    mt_entry++)
 					mt_entry->device_info |=
 					    MPS_DEV_RESERVED;
-				et_entry->skip_search = 0;
+				enc_entry->skip_search = 0;
 			}
 		}
 		done_flag = 1;