From 0d4033d95d1cde66c3bc757aedb335e884c3be6c Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 7 Jul 2007 08:52:35 +0000 Subject: [PATCH] - 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. svn path=/trunk/; revision=27445 --- reactos/drivers/storage/scsiport/scsiport.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/storage/scsiport/scsiport.c b/reactos/drivers/storage/scsiport/scsiport.c index 9b2a68ed0e2..8c0ae7a0975 100644 --- a/reactos/drivers/storage/scsiport/scsiport.c +++ b/reactos/drivers/storage/scsiport/scsiport.c @@ -849,6 +849,9 @@ ScsiPortInitialize(IN PVOID Argument1, /* 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 @@ CreatePortConfig: HwInitializationData, PortConfig, RegistryPath, - BusNumber, + ConfigInfo.BusNumber, &SlotNumber)) { /* Continue to the next bus, nothing here */ @@ -2087,10 +2090,12 @@ SpiGetPciConfigData(IN PDRIVER_OBJECT DriverObject, &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;