https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ac5536aa48b48d75ab99c9f385d245892f2ed630

commit ac5536aa48b48d75ab99c9f385d245892f2ed630
Author:     Hervé Poussineau <hpous...@reactos.org>
AuthorDate: Fri Dec 17 09:01:34 2021 +0100
Commit:     Hervé Poussineau <hpous...@reactos.org>
CommitDate: Fri Dec 17 11:09:23 2021 +0100

    [SCSIPORT] Ignore LUNs not supported by the adapter
    
    CORE-17641
---
 drivers/storage/port/scsiport/fdo.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/storage/port/scsiport/fdo.c 
b/drivers/storage/port/scsiport/fdo.c
index bdb6bf32b38..8972c6f1aea 100644
--- a/drivers/storage/port/scsiport/fdo.c
+++ b/drivers/storage/port/scsiport/fdo.c
@@ -251,11 +251,17 @@ FdoScanAdapter(
             /* Scan all logical units */
             for (UINT8 lun = 0; lun < PortExtension->MaxLunCount; lun++)
             {
+                PSCSI_PORT_LUN_EXTENSION lunExt;
+
+                /* Skip invalid lun values */
+                if (lun >= 
PortExtension->PortConfig->MaximumNumberOfLogicalUnits)
+                    continue;
+
                 // try to find an existing device
-                PSCSI_PORT_LUN_EXTENSION lunExt = GetLunByPath(PortExtension,
-                                                               pathId,
-                                                               targetId,
-                                                               lun);
+                lunExt = GetLunByPath(PortExtension,
+                                      pathId,
+                                      targetId,
+                                      lun);
 
                 if (lunExt)
                 {

Reply via email to