[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/3] Fix CodeQL warnings
- ExAllocatePoolWithTag is deprecated in Win10 2004, use ExAllocatePoolUninitialized instead - QueryCapabilities structure contains padding bytes, using __AllocatePoolWithTag zeros this memory Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/xennet/driver.c | 3 ++- src/xennet/receiver.c | 4 ++-- src/xennet/transmitter.c | 5 +++-- src/xennet/util.h | 4 ++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/xennet/driver.c b/src/xennet/driver.c index 20f1d0e..8127621 100644 --- a/src/xennet/driver.c +++ b/src/xennet/driver.c @@ -37,6 +37,7 @@ #include "miniport.h" #include "dbg_print.h" #include "assert.h" +#include "util.h" typedef struct _XENNET_DRIVER { NDIS_HANDLE MiniportHandle; @@ -93,7 +94,7 @@ QueryCapabilities( StackLocation = IoGetCurrentIrpStackLocation(Irp); - Context = ExAllocatePoolWithTag(NonPagedPool, sizeof (XENNET_CONTEXT), ' TEN'); + Context = __AllocatePoolWithTag(NonPagedPool, sizeof (XENNET_CONTEXT), ' TEN'); if (Context != NULL) { Context->Capabilities = StackLocation->Parameters.DeviceCapabilities.Capabilities; Context->CompletionRoutine = StackLocation->CompletionRoutine; diff --git a/src/xennet/receiver.c b/src/xennet/receiver.c index ff9a7c5..b46d250 100644 --- a/src/xennet/receiver.c +++ b/src/xennet/receiver.c @@ -435,7 +435,7 @@ ReceiverInitialize( ULONG Index; NDIS_STATUS status; - *Receiver = ExAllocatePoolWithTag(NonPagedPool, + *Receiver = __AllocatePoolWithTag(NonPagedPool, sizeof(XENNET_RECEIVER), RECEIVER_POOL_TAG); @@ -519,7 +519,7 @@ ReceiverTeardown( Receiver->Adapter = NULL; - ExFreePoolWithTag(Receiver, RECEIVER_POOL_TAG); + __FreePoolWithTag(Receiver, RECEIVER_POOL_TAG); } VOID diff --git a/src/xennet/transmitter.c b/src/xennet/transmitter.c index 334bbb9..c962814 100644 --- a/src/xennet/transmitter.c +++ b/src/xennet/transmitter.c @@ -36,6 +36,7 @@ #include <tcpip.h> #include "dbg_print.h" #include "assert.h" +#include "util.h" struct _XENNET_TRANSMITTER { PXENNET_ADAPTER Adapter; @@ -53,7 +54,7 @@ TransmitterInitialize ( { NTSTATUS status; - *Transmitter = ExAllocatePoolWithTag(NonPagedPool, + *Transmitter = __AllocatePoolWithTag(NonPagedPool, sizeof(XENNET_TRANSMITTER), TRANSMITTER_POOL_TAG); @@ -85,7 +86,7 @@ TransmitterTeardown( RtlZeroMemory(&Transmitter->Lock, sizeof(KSPIN_LOCK)); - ExFreePoolWithTag(Transmitter, TRANSMITTER_POOL_TAG); + __FreePoolWithTag(Transmitter, TRANSMITTER_POOL_TAG); } typedef struct _NET_BUFFER_LIST_RESERVED { diff --git a/src/xennet/util.h b/src/xennet/util.h index 9a9a8ff..8ef6097 100644 --- a/src/xennet/util.h +++ b/src/xennet/util.h @@ -151,8 +151,12 @@ __AllocatePoolWithTag( __analysis_assume(PoolType == NonPagedPool || PoolType == PagedPool); +#if (_MSC_VER >= 1928) // VS 16.9 (EWDK 20344 or later) + Buffer = ExAllocatePoolUninitialized(PoolType, NumberOfBytes, Tag); +#else #pragma warning(suppress:28160) // annotation error Buffer = ExAllocatePoolWithTag(PoolType, NumberOfBytes, Tag); +#endif if (Buffer == NULL) return NULL; -- 2.31.1.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |