summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatwilli <[email protected]>2021-04-20 10:59:31 -0700
committerGitHub <[email protected]>2021-04-20 10:59:31 -0700
commit80c104ad0cef2a4fb55aaee7d494f30af5fb44b4 (patch)
treedfb8ab99407da02a71c420a726a7f7439b27e6a8
parent5ab839435fd1c6d5f60171312cc0b078544b060d (diff)
Buses samples should use ExAllocatePool2 (#611)
* Updating samples to utilize ExAllocatePool2 which zero-initializes pool allocations
-rw-r--r--general/echo/kmdf/driver/AutoSync/queue.c2
-rw-r--r--general/echo/kmdf/driver/DriverSync/queue.c2
-rw-r--r--general/ioctl/kmdf/sys/nonpnp.c4
-rw-r--r--general/toaster/toastDrv/kmdf/bus/dynamic/buspdo.c4
-rw-r--r--general/toaster/toastDrv/kmdf/func/featured/wmi.c4
-rw-r--r--serial/serial/ioctl.c4
-rw-r--r--serial/serial/openclos.c12
-rw-r--r--usb/UcmCxUcsi/Acpi.cpp8
-rw-r--r--usb/ufxclientsample/device.c4
-rw-r--r--usb/usbsamp/sys/private.h5
-rw-r--r--usb/usbsamp/sys/stream.c4
11 files changed, 22 insertions, 31 deletions
diff --git a/general/echo/kmdf/driver/AutoSync/queue.c b/general/echo/kmdf/driver/AutoSync/queue.c
index d881c003..7e2e915f 100644
--- a/general/echo/kmdf/driver/AutoSync/queue.c
+++ b/general/echo/kmdf/driver/AutoSync/queue.c
@@ -423,7 +423,7 @@ Return Value:
queueContext->Length = 0L;
}
- queueContext->Buffer = ExAllocatePoolWithTag(NonPagedPoolNx, Length, 'sam1');
+ queueContext->Buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, Length, 'sam1');
if( queueContext->Buffer == NULL ) {
KdPrint(("EchoEvtIoWrite: Could not allocate %Iu byte buffer\n", Length));
WdfRequestComplete(Request, STATUS_INSUFFICIENT_RESOURCES);
diff --git a/general/echo/kmdf/driver/DriverSync/queue.c b/general/echo/kmdf/driver/DriverSync/queue.c
index 7835b73b..1b34b616 100644
--- a/general/echo/kmdf/driver/DriverSync/queue.c
+++ b/general/echo/kmdf/driver/DriverSync/queue.c
@@ -649,7 +649,7 @@ Return Value:
queueContext->Length = 0L;
}
- queueContext->Buffer = ExAllocatePoolWithTag(NonPagedPoolNx, Length, 'sam1');
+ queueContext->Buffer = ExAllocatePool2(POOL_FLAG_NON_PAGED, Length, 'sam1');
if( queueContext->Buffer == NULL ) {
KdPrint(("EchoEvtIoWrite: Could not allocate %Iu byte buffer\n",Length));
WdfRequestComplete(Request, STATUS_INSUFFICIENT_RESOURCES);
diff --git a/general/ioctl/kmdf/sys/nonpnp.c b/general/ioctl/kmdf/sys/nonpnp.c
index 519ae838..a36c98c1 100644
--- a/general/ioctl/kmdf/sys/nonpnp.c
+++ b/general/ioctl/kmdf/sys/nonpnp.c
@@ -459,10 +459,10 @@ Return Value:
//
length = directory.Length + fileName->Length;
- absFileName.Buffer = ExAllocatePoolWithTag(PagedPool, length, POOL_TAG);
+ absFileName.Buffer = ExAllocatePool2(POOL_FLAG_PAGED, length, POOL_TAG);
if(absFileName.Buffer == NULL) {
status = STATUS_INSUFFICIENT_RESOURCES;
- TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "ExAllocatePoolWithTag failed");
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_INIT, "ExAllocatePool2 failed");
goto End;
}
absFileName.Length = 0;
diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/buspdo.c b/general/toaster/toastDrv/kmdf/bus/dynamic/buspdo.c
index d7d2cf54..52c847d3 100644
--- a/general/toaster/toastDrv/kmdf/bus/dynamic/buspdo.c
+++ b/general/toaster/toastDrv/kmdf/bus/dynamic/buspdo.c
@@ -82,8 +82,8 @@ Return Value:
return status;
}
- dst->HardwareIds = (PWCHAR) ExAllocatePoolWithTag(
- NonPagedPoolNx,
+ dst->HardwareIds = (PWCHAR) ExAllocatePool2(
+ POOL_FLAG_NON_PAGED,
safeMultResult,
BUS_TAG);
diff --git a/general/toaster/toastDrv/kmdf/func/featured/wmi.c b/general/toaster/toastDrv/kmdf/func/featured/wmi.c
index e7c76a23..f62eacd3 100644
--- a/general/toaster/toastDrv/kmdf/func/featured/wmi.c
+++ b/general/toaster/toastDrv/kmdf/func/featured/wmi.c
@@ -446,11 +446,9 @@ ToasterFireArrivalEvent(
//
// Allocate memory for the WNODE from NonPagedPoolNx
//
- wnode = ExAllocatePoolWithTag(NonPagedPoolNx, size, TOASTER_POOL_TAG);
+ wnode = ExAllocatePool2(POOL_FLAG_NON_PAGED, size, TOASTER_POOL_TAG);
if (NULL != wnode) {
- RtlZeroMemory(wnode, size);
-
wnode->WnodeHeader.BufferSize = size;
wnode->WnodeHeader.ProviderId =
IoWMIDeviceObjectToProviderId(
diff --git a/serial/serial/ioctl.c b/serial/serial/ioctl.c
index 339cdc6a..192f3955 100644
--- a/serial/serial/ioctl.c
+++ b/serial/serial/ioctl.c
@@ -1297,8 +1297,8 @@ Return Value:
}
reqContext->Type3InputBuffer =
- ExAllocatePoolWithQuotaTag(
- NonPagedPoolNx | POOL_QUOTA_FAIL_INSTEAD_OF_RAISE,
+ ExAllocatePool2(
+ POOL_FLAG_NON_PAGED | POOL_FLAG_USE_QUOTA,
Rs->InSize,
POOL_TAG
);
diff --git a/serial/serial/openclos.c b/serial/serial/openclos.c
index c59439e9..321e5206 100644
--- a/serial/serial/openclos.c
+++ b/serial/serial/openclos.c
@@ -148,8 +148,8 @@ SerialDeviceFileCreateWorker (
case MmLargeSystem: {
extension->BufferSize = 4096;
- extension->InterruptReadBuffer = ExAllocatePoolWithTag(
- NonPagedPoolNx,
+ extension->InterruptReadBuffer = ExAllocatePool2(
+ POOL_FLAG_NON_PAGED,
extension->BufferSize,
POOL_TAG
);
@@ -163,8 +163,8 @@ SerialDeviceFileCreateWorker (
case MmMediumSystem: {
extension->BufferSize = 1024;
- extension->InterruptReadBuffer = ExAllocatePoolWithTag(
- NonPagedPoolNx,
+ extension->InterruptReadBuffer = ExAllocatePool2(
+ POOL_FLAG_NON_PAGED,
extension->BufferSize,
POOL_TAG
);
@@ -178,8 +178,8 @@ SerialDeviceFileCreateWorker (
case MmSmallSystem: {
extension->BufferSize = 128;
- extension->InterruptReadBuffer = ExAllocatePoolWithTag(
- NonPagedPoolNx,
+ extension->InterruptReadBuffer = ExAllocatePool2(
+ POOL_FLAG_NON_PAGED,
extension->BufferSize,
POOL_TAG
);
diff --git a/usb/UcmCxUcsi/Acpi.cpp b/usb/UcmCxUcsi/Acpi.cpp
index ed90260d..33dec487 100644
--- a/usb/UcmCxUcsi/Acpi.cpp
+++ b/usb/UcmCxUcsi/Acpi.cpp
@@ -554,9 +554,9 @@ Acpi_EvaluateUcsiDsm (
FIELD_OFFSET(ACPI_EVAL_OUTPUT_BUFFER, Argument) +
outputArgumentBufferSize;
- outputBuffer = (PACPI_EVAL_OUTPUT_BUFFER) ExAllocatePoolWithTag(NonPagedPoolNx,
- outputBufferSize,
- TAG_UCSI);
+ outputBuffer = (PACPI_EVAL_OUTPUT_BUFFER) ExAllocatePool2(POOL_FLAG_NON_PAGED,
+ outputBufferSize,
+ TAG_UCSI);
if (outputBuffer == nullptr)
{
@@ -565,8 +565,6 @@ Acpi_EvaluateUcsiDsm (
goto Exit;
}
- RtlZeroMemory(outputBuffer, outputBufferSize);
-
WDF_MEMORY_DESCRIPTOR_INIT_HANDLE(&inputMemDesc, inputMemory, NULL);
WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&outputMemDesc, outputBuffer, (ULONG) outputBufferSize);
diff --git a/usb/ufxclientsample/device.c b/usb/ufxclientsample/device.c
index 3aa46c4c..8a7580bf 100644
--- a/usb/ufxclientsample/device.c
+++ b/usb/ufxclientsample/device.c
@@ -535,8 +535,8 @@ Arguments:
DeviceContext = UfxDeviceGetContext(ControllerContext->UfxDevice);
#pragma prefast(suppress:6014, "Memory allocation is expected")
- HardwareFailureContext = ExAllocatePoolWithTag(
- NonPagedPoolNx,
+ HardwareFailureContext = ExAllocatePool2(
+ POOL_FLAG_NON_PAGED,
sizeof(HARDWARE_FAILURE_CONTEXT),
UFX_CLIENT_TAG);
diff --git a/usb/usbsamp/sys/private.h b/usb/usbsamp/sys/private.h
index d6d7898b..def503f5 100644
--- a/usb/usbsamp/sys/private.h
+++ b/usb/usbsamp/sys/private.h
@@ -52,11 +52,6 @@ Environment:
#define DISPATCH_LATENCY_IN_MS 10
-
-#undef ExAllocatePool
-#define ExAllocatePool(type, size) \
- ExAllocatePoolWithTag(type, size, POOL_TAG);
-
#if DBG
#define UsbSamp_DbgPrint(level, _x_) \
diff --git a/usb/usbsamp/sys/stream.c b/usb/usbsamp/sys/stream.c
index ee434b35..d8cc05d9 100644
--- a/usb/usbsamp/sys/stream.c
+++ b/usb/usbsamp/sys/stream.c
@@ -199,8 +199,8 @@ Return Value:
pStreamInfo->NumberOfStreams = supportedStreams;
- pStreamInfo->StreamList = ExAllocatePoolWithTag(
- NonPagedPoolNx,
+ pStreamInfo->StreamList = ExAllocatePool2(
+ POOL_FLAG_NON_PAGED,
supportedStreams * sizeof(USBD_STREAM_INFORMATION),
POOL_TAG);