mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 16:32:57 +00:00
[RAMDISK]
- Fix DeviceRelations allocation bug - Code style: Use sizeof(UNICODE_NULL) where needed; use sizeof(*ptr) for size of type pointed by ptr, when allocating space for ptr. svn path=/trunk/; revision=66020
This commit is contained in:
parent
64f6189e30
commit
79f472a422
1 changed files with 11 additions and 12 deletions
|
@ -1345,7 +1345,7 @@ RamdiskQueryDeviceRelations(IN DEVICE_RELATION_TYPE Type,
|
||||||
|
|
||||||
/* Allocate a buffer big enough to contain only one DO */
|
/* Allocate a buffer big enough to contain only one DO */
|
||||||
DeviceRelations = ExAllocatePoolWithTag(PagedPool,
|
DeviceRelations = ExAllocatePoolWithTag(PagedPool,
|
||||||
sizeof(DeviceRelations),
|
sizeof(*DeviceRelations),
|
||||||
'dmaR');
|
'dmaR');
|
||||||
if (DeviceRelations != NULL)
|
if (DeviceRelations != NULL)
|
||||||
{
|
{
|
||||||
|
@ -1795,7 +1795,7 @@ RamdiskQueryBusInformation(IN PDEVICE_OBJECT DeviceObject,
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
/* Allocate output memory */
|
/* Allocate output memory */
|
||||||
PnpBusInfo = ExAllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION), 'dmaR');
|
PnpBusInfo = ExAllocatePoolWithTag(PagedPool, sizeof(*PnpBusInfo), 'dmaR');
|
||||||
if (PnpBusInfo == NULL)
|
if (PnpBusInfo == NULL)
|
||||||
{
|
{
|
||||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
@ -2301,8 +2301,7 @@ RamdiskAddDevice(IN PDRIVER_OBJECT DriverObject,
|
||||||
{
|
{
|
||||||
/* Initialize the bus FDO extension */
|
/* Initialize the bus FDO extension */
|
||||||
DeviceExtension = DeviceObject->DeviceExtension;
|
DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
RtlZeroMemory(DeviceObject->DeviceExtension,
|
RtlZeroMemory(DeviceExtension, sizeof(*DeviceExtension));
|
||||||
sizeof(RAMDISK_BUS_EXTENSION));
|
|
||||||
|
|
||||||
/* Set bus FDO flags */
|
/* Set bus FDO flags */
|
||||||
DeviceObject->Flags |= DO_POWER_PAGABLE | DO_DIRECT_IO;
|
DeviceObject->Flags |= DO_POWER_PAGABLE | DO_DIRECT_IO;
|
||||||
|
@ -2378,7 +2377,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
|
||||||
DriverRegistryPath = *RegistryPath;
|
DriverRegistryPath = *RegistryPath;
|
||||||
DriverRegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool,
|
DriverRegistryPath.Buffer = ExAllocatePoolWithTag(PagedPool,
|
||||||
RegistryPath->Length +
|
RegistryPath->Length +
|
||||||
sizeof(WCHAR),
|
sizeof(UNICODE_NULL),
|
||||||
'dmaR');
|
'dmaR');
|
||||||
if (!DriverRegistryPath.Buffer) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!DriverRegistryPath.Buffer) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
RtlCopyUnicodeString(&DriverRegistryPath, RegistryPath);
|
RtlCopyUnicodeString(&DriverRegistryPath, RegistryPath);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue