mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 14:45:53 +00:00
[SCSIPORT]
Fix a bug in size calculation that causes memory corruption on 64 bit Fix some MSVC/x64 warnings [UNIATA] Fix some MSVC/x64 warnings svn path=/trunk/; revision=58985
This commit is contained in:
parent
b70c15e6b4
commit
7647f53075
2 changed files with 17 additions and 16 deletions
|
@ -10671,8 +10671,8 @@ AtapiRegCheckParameterValue(
|
||||||
// KdPrint(( "AtapiCheckRegValue: RegistryPath %ws\n", RegistryPath->Buffer));
|
// KdPrint(( "AtapiCheckRegValue: RegistryPath %ws\n", RegistryPath->Buffer));
|
||||||
|
|
||||||
paramPath.Length = 0;
|
paramPath.Length = 0;
|
||||||
paramPath.MaximumLength = RegistryPath->Length +
|
paramPath.MaximumLength = (USHORT)(RegistryPath->Length +
|
||||||
(wcslen(PathSuffix)+2)*sizeof(WCHAR);
|
(wcslen(PathSuffix)+2)*sizeof(WCHAR));
|
||||||
paramPath.Buffer = (PWCHAR)ExAllocatePool(NonPagedPool, paramPath.MaximumLength);
|
paramPath.Buffer = (PWCHAR)ExAllocatePool(NonPagedPool, paramPath.MaximumLength);
|
||||||
if(!paramPath.Buffer) {
|
if(!paramPath.Buffer) {
|
||||||
KdPrint(("AtapiCheckRegValue: couldn't allocate paramPath\n"));
|
KdPrint(("AtapiCheckRegValue: couldn't allocate paramPath\n"));
|
||||||
|
|
|
@ -623,8 +623,8 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
||||||
{
|
{
|
||||||
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
|
PSCSI_PORT_DEVICE_EXTENSION DeviceExtension;
|
||||||
SCSI_PHYSICAL_ADDRESS PhysicalAddress;
|
SCSI_PHYSICAL_ADDRESS PhysicalAddress;
|
||||||
ULONG BufferLength = 0;
|
SIZE_T BufferLength = 0;
|
||||||
ULONG Offset;
|
ULONG_PTR Offset;
|
||||||
PSCSI_SG_ADDRESS SGList;
|
PSCSI_SG_ADDRESS SGList;
|
||||||
PSCSI_REQUEST_BLOCK_INFO SrbInfo;
|
PSCSI_REQUEST_BLOCK_INFO SrbInfo;
|
||||||
|
|
||||||
|
@ -673,7 +673,7 @@ ScsiPortGetPhysicalAddress(IN PVOID HwDeviceExtension,
|
||||||
PhysicalAddress.QuadPart = (LONGLONG)(SP_UNINITIALIZED_VALUE);
|
PhysicalAddress.QuadPart = (LONGLONG)(SP_UNINITIALIZED_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
*Length = BufferLength;
|
*Length = (ULONG)BufferLength;
|
||||||
return PhysicalAddress;
|
return PhysicalAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,6 +1034,7 @@ ScsiPortInitialize(IN PVOID Argument1,
|
||||||
KIRQL OldIrql;
|
KIRQL OldIrql;
|
||||||
PCM_RESOURCE_LIST ResourceList;
|
PCM_RESOURCE_LIST ResourceList;
|
||||||
BOOLEAN Conflict;
|
BOOLEAN Conflict;
|
||||||
|
SIZE_T BusConfigSize;
|
||||||
|
|
||||||
|
|
||||||
DPRINT ("ScsiPortInitialize() called!\n");
|
DPRINT ("ScsiPortInitialize() called!\n");
|
||||||
|
@ -1635,10 +1636,11 @@ CreatePortConfig:
|
||||||
IoStartTimer(PortDeviceObject);
|
IoStartTimer(PortDeviceObject);
|
||||||
|
|
||||||
/* Initialize bus scanning information */
|
/* Initialize bus scanning information */
|
||||||
|
BusConfigSize = FIELD_OFFSET(BUSES_CONFIGURATION_INFORMATION,
|
||||||
|
BusScanInfo[DeviceExtension->PortConfig->NumberOfBuses]);
|
||||||
DeviceExtension->BusesConfig = ExAllocatePoolWithTag(PagedPool,
|
DeviceExtension->BusesConfig = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(PVOID) * DeviceExtension->PortConfig->NumberOfBuses
|
BusConfigSize,
|
||||||
+ sizeof(ULONG), TAG_SCSIPORT);
|
TAG_SCSIPORT);
|
||||||
|
|
||||||
if (!DeviceExtension->BusesConfig)
|
if (!DeviceExtension->BusesConfig)
|
||||||
{
|
{
|
||||||
DPRINT1("Out of resources!\n");
|
DPRINT1("Out of resources!\n");
|
||||||
|
@ -1647,9 +1649,7 @@ CreatePortConfig:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero it */
|
/* Zero it */
|
||||||
RtlZeroMemory(DeviceExtension->BusesConfig,
|
RtlZeroMemory(DeviceExtension->BusesConfig, BusConfigSize);
|
||||||
sizeof(PVOID) * DeviceExtension->PortConfig->NumberOfBuses
|
|
||||||
+ sizeof(ULONG));
|
|
||||||
|
|
||||||
/* Store number of buses there */
|
/* Store number of buses there */
|
||||||
DeviceExtension->BusesConfig->NumberOfBuses = (UCHAR)DeviceExtension->BusNum;
|
DeviceExtension->BusesConfig->NumberOfBuses = (UCHAR)DeviceExtension->BusNum;
|
||||||
|
@ -2622,6 +2622,7 @@ ScsiPortDispatchScsi(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
|
||||||
case SRB_FUNCTION_EXECUTE_SCSI:
|
case SRB_FUNCTION_EXECUTE_SCSI:
|
||||||
case SRB_FUNCTION_IO_CONTROL:
|
case SRB_FUNCTION_IO_CONTROL:
|
||||||
|
DPRINT(" SRB_FUNCTION_EXECUTE_SCSI or SRB_FUNCTION_IO_CONTROL\n");
|
||||||
/* Mark IRP as pending in all cases */
|
/* Mark IRP as pending in all cases */
|
||||||
IoMarkIrpPending(Irp);
|
IoMarkIrpPending(Irp);
|
||||||
|
|
||||||
|
@ -4013,7 +4014,7 @@ SpiGetInquiryData(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
BusData = &AdapterBusInfo->BusData[Bus];
|
BusData = &AdapterBusInfo->BusData[Bus];
|
||||||
|
|
||||||
/* Calculate and save an offset of the inquiry data */
|
/* Calculate and save an offset of the inquiry data */
|
||||||
BusData->InquiryDataOffset = (PUCHAR)InquiryData - Buffer;
|
BusData->InquiryDataOffset = (ULONG)((PUCHAR)InquiryData - Buffer);
|
||||||
|
|
||||||
/* Get a pointer to the LUN information structure */
|
/* Get a pointer to the LUN information structure */
|
||||||
LunInfo = DeviceExtension->BusesConfig->BusScanInfo[Bus]->LunInfo;
|
LunInfo = DeviceExtension->BusesConfig->BusScanInfo[Bus]->LunInfo;
|
||||||
|
@ -4039,7 +4040,7 @@ SpiGetInquiryData(IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
InquiryData->InquiryDataLength = INQUIRYDATABUFFERSIZE;
|
InquiryData->InquiryDataLength = INQUIRYDATABUFFERSIZE;
|
||||||
InquiryData->DeviceClaimed = LunInfo->DeviceClaimed;
|
InquiryData->DeviceClaimed = LunInfo->DeviceClaimed;
|
||||||
InquiryData->NextInquiryDataOffset =
|
InquiryData->NextInquiryDataOffset =
|
||||||
(PUCHAR)InquiryData + InquiryDataSize - Buffer;
|
(ULONG)((PUCHAR)InquiryData + InquiryDataSize - Buffer);
|
||||||
|
|
||||||
/* Copy data in it */
|
/* Copy data in it */
|
||||||
RtlCopyMemory(InquiryData->InquiryData,
|
RtlCopyMemory(InquiryData->InquiryData,
|
||||||
|
@ -5364,7 +5365,7 @@ SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
DriverName,
|
DriverName,
|
||||||
(wcslen(DriverName) + 1) * sizeof(WCHAR));
|
(ULONG)((wcslen(DriverName) + 1) * sizeof(WCHAR)));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("ZwSetValueKey('Driver') failed (Status %lx)\n", Status);
|
DPRINT("ZwSetValueKey('Driver') failed (Status %lx)\n", Status);
|
||||||
|
@ -5557,7 +5558,7 @@ SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
NameBuffer,
|
NameBuffer,
|
||||||
(wcslen(NameBuffer) + 1) * sizeof(WCHAR));
|
(ULONG)((wcslen(NameBuffer) + 1) * sizeof(WCHAR)));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("ZwSetValueKey('Identifier') failed (Status %lx)\n", Status);
|
DPRINT("ZwSetValueKey('Identifier') failed (Status %lx)\n", Status);
|
||||||
|
@ -5606,7 +5607,7 @@ SpiBuildDeviceMap (PSCSI_PORT_DEVICE_EXTENSION DeviceExtension,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
TypeName,
|
TypeName,
|
||||||
(wcslen(TypeName) + 1) * sizeof(WCHAR));
|
(ULONG)((wcslen(TypeName) + 1) * sizeof(WCHAR)));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("ZwSetValueKey('Type') failed (Status %lx)\n", Status);
|
DPRINT("ZwSetValueKey('Type') failed (Status %lx)\n", Status);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue