[ros-diffs] [fireball] 27445: - Zero initialize a variable (I have no idea how PREfast missed this important flaw). - Fix PCI bus enumeration, so that finding SCSI controllers on PCI bus works now.

fireball at svn.reactos.org fireball at svn.reactos.org
Sat Jul 7 10:52:36 CEST 2007


Author: fireball
Date: Sat Jul  7 12:52:35 2007
New Revision: 27445

URL: http://svn.reactos.org/svn/reactos?rev=27445&view=rev
Log:
- Zero initialize a variable (I have no idea how PREfast missed this important flaw).
- Fix PCI bus enumeration, so that finding SCSI controllers on PCI bus works now.

Modified:
    trunk/reactos/drivers/storage/scsiport/scsiport.c

Modified: trunk/reactos/drivers/storage/scsiport/scsiport.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/storage/scsiport/scsiport.c?rev=27445&r1=27444&r2=27445&view=diff
==============================================================================
--- trunk/reactos/drivers/storage/scsiport/scsiport.c (original)
+++ trunk/reactos/drivers/storage/scsiport/scsiport.c Sat Jul  7 12:52:35 2007
@@ -849,6 +849,9 @@
     /* Zero the internal configuration info structure */
     RtlZeroMemory(&ConfigInfo, sizeof(CONFIGURATION_INFO));
 
+    /* Zero starting slot number */
+    SlotNumber.u.AsULONG = 0;
+
     /* Allocate space for access ranges */
     if (HwInitializationData->NumberOfAccessRanges)
     {
@@ -1025,7 +1028,7 @@
                                    HwInitializationData,
                                    PortConfig,
                                    RegistryPath,
-                                   BusNumber,
+                                   ConfigInfo.BusNumber,
                                    &SlotNumber))
           {
               /* Continue to the next bus, nothing here */
@@ -2087,10 +2090,12 @@
                                      &PciConfig,
                                      sizeof(ULONG));
 
-            /* There is nothing there */
-            if (DataSize < sizeof(ULONG))
+            /* If result of HalGetBusData is 0, then the bus is wrong */
+            if (DataSize == 0)
                 return FALSE;
 
+            /* If result is PCI_INVALID_VENDORID, then this device has no more
+               "Functions" */
             if (PciConfig.VendorID == PCI_INVALID_VENDORID)
                 break;
 




More information about the Ros-diffs mailing list