DragonFlyBSD Kernel Audit
DF-1224 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/mpr/mpr_sas.c b/sys/dev/raid/mpr/mpr_sas.c
--- a/sys/dev/raid/mpr/mpr_sas.c
+++ b/sys/dev/raid/mpr/mpr_sas.c
@@ -2770,7 +2770,8 @@
 			TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
 			alloc_len = ((u16)scsi_cdb[3] << 8) + scsi_cdb[4];
 			alloc_len -= csio->resid;
-			for (i = 0; i < MIN(vpd_list->length, alloc_len); i++) {
+				for (i = 0; i < MIN(vpd_list->length, alloc_len) &&
+				    i < (int)nitems(vpd_list->list); i++) {
 				if (vpd_list->list[i] == 0x90) {
 					*TLR_bits = TLR_on;
 					break;