Skip to content

Commit

Permalink
Merge pull request microsoft#694 from tmolenh/extension-pool
Browse files Browse the repository at this point in the history
VMSwitch Extension: Replace ExAllocatePool* with ExAllocatePool2
  • Loading branch information
tobafo19 authored Mar 22, 2022
2 parents 9bb77eb + f1969c3 commit 69b7d1f
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
10 changes: 5 additions & 5 deletions network/ndis/extension/base/SxBase.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ SxNdisAttach(
}

switchObjectSize = sizeof(SX_SWITCH_OBJECT);
switchObject = ExAllocatePoolWithTag(NonPagedPoolNx,
switchObjectSize,
SxExtAllocationTag);
switchObject = ExAllocatePool2(POOL_FLAG_NON_PAGED,
switchObjectSize,
SxExtAllocationTag);

if (switchObject == NULL)
{
Expand Down Expand Up @@ -1256,8 +1256,8 @@ SxpNdisProcessMethodOid(
ASSERT(Switch->OldNicRequest == NULL);
Switch->OldNicRequest = nicOidRequest;

newNicOidRequest = (PNDIS_SWITCH_NIC_OID_REQUEST)ExAllocatePoolWithTag(
NonPagedPoolNx,
newNicOidRequest = (PNDIS_SWITCH_NIC_OID_REQUEST)ExAllocatePool2(
POOL_FLAG_NON_PAGED,
sizeof(NDIS_SWITCH_NIC_OID_REQUEST),
SxExtAllocationTag);

Expand Down
42 changes: 21 additions & 21 deletions network/ndis/extension/base/SxLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ SxLibIssueOidRequest(
// Dynamically allocate filter request so that we can handle asynchronous
// completion.
//
oidRequest = (PSX_OID_REQUEST)ExAllocatePoolWithTag(NonPagedPoolNx,
sizeof(SX_OID_REQUEST),
SxExtAllocationTag);
oidRequest = (PSX_OID_REQUEST)ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(SX_OID_REQUEST),
SxExtAllocationTag);
if (oidRequest == NULL)
{
goto Cleanup;
Expand Down Expand Up @@ -469,9 +469,9 @@ SxLibGetPortArrayUnsafe(
if (BytesNeeded != 0)
{
arrayLength = BytesNeeded;
portArray = ExAllocatePoolWithTag(NonPagedPoolNx,
arrayLength,
SxExtAllocationTag);
portArray = ExAllocatePool2(POOL_FLAG_NON_PAGED,
arrayLength,
SxExtAllocationTag);

if (portArray == NULL)
{
Expand Down Expand Up @@ -529,9 +529,9 @@ SxLibGetNicArrayUnsafe(
if (BytesNeeded != 0)
{
arrayLength = BytesNeeded;
nicArray = ExAllocatePoolWithTag(NonPagedPoolNx,
arrayLength,
SxExtAllocationTag);
nicArray = ExAllocatePool2(POOL_FLAG_NON_PAGED,
arrayLength,
SxExtAllocationTag);

if (nicArray == NULL)
{
Expand Down Expand Up @@ -602,9 +602,9 @@ SxLibGetSwitchPropertyUnsafe(
ASSERT(PropertyType != NdisSwitchPropertyTypeCustom);
}

outputBuffer = ExAllocatePoolWithTag(NonPagedPoolNx,
outputBufferLength,
SxExtAllocationTag);
outputBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED,
outputBufferLength,
SxExtAllocationTag);

if (outputBuffer == NULL)
{
Expand All @@ -619,9 +619,9 @@ SxLibGetSwitchPropertyUnsafe(
ExFreePoolWithTag(outputBuffer, SxExtAllocationTag);

outputBufferLength = (USHORT)bytesNeeded;
outputBuffer = ExAllocatePoolWithTag(NonPagedPoolNx,
outputBufferLength,
SxExtAllocationTag);
outputBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED,
outputBufferLength,
SxExtAllocationTag);

if (outputBuffer == NULL)
{
Expand Down Expand Up @@ -698,9 +698,9 @@ SxLibGetPortPropertyUnsafe(
ASSERT(PropertyType != NdisSwitchPortPropertyTypeCustom);
}

outputBuffer = ExAllocatePoolWithTag(NonPagedPoolNx,
outputBufferLength,
SxExtAllocationTag);
outputBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED,
outputBufferLength,
SxExtAllocationTag);

if (outputBuffer == NULL)
{
Expand All @@ -715,9 +715,9 @@ SxLibGetPortPropertyUnsafe(
ExFreePoolWithTag(outputBuffer, SxExtAllocationTag);

outputBufferLength = (USHORT)bytesNeeded;
outputBuffer = ExAllocatePoolWithTag(NonPagedPoolNx,
outputBufferLength,
SxExtAllocationTag);
outputBuffer = ExAllocatePool2(POOL_FLAG_NON_PAGED,
outputBufferLength,
SxExtAllocationTag);

if (outputBuffer == NULL)
{
Expand Down
18 changes: 9 additions & 9 deletions network/ndis/extension/samples/forward/MsForwardExt.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ Routine Description:
NDIS_STATUS status = NDIS_STATUS_SUCCESS;
PMSFORWARD_CONTEXT switchContext;

switchContext = ExAllocatePoolWithTag(NonPagedPoolNx,
sizeof(MSFORWARD_CONTEXT),
SxExtAllocationTag);
switchContext = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(MSFORWARD_CONTEXT),
SxExtAllocationTag);

if (switchContext == NULL)
{
Expand Down Expand Up @@ -1879,9 +1879,9 @@ Routine Description:

if (nicEntry == NULL)
{
nicEntry = ExAllocatePoolWithTag(NonPagedPoolNx,
sizeof(MSFORWARD_NIC_LIST_ENTRY),
SxExtAllocationTag);
nicEntry = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(MSFORWARD_NIC_LIST_ENTRY),
SxExtAllocationTag);

if (nicEntry == NULL)
{
Expand Down Expand Up @@ -1937,9 +1937,9 @@ Routine Description:

if (newPolicy == NULL)
{
newPolicy = ExAllocatePoolWithTag(NonPagedPoolNx,
sizeof(MSFORWARD_MAC_POLICY_LIST_ENTRY),
SxExtAllocationTag);
newPolicy = ExAllocatePool2(POOL_FLAG_NON_PAGED,
sizeof(MSFORWARD_MAC_POLICY_LIST_ENTRY),
SxExtAllocationTag);

if (newPolicy == NULL)
{
Expand Down

0 comments on commit 69b7d1f

Please sign in to comment.