[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 3/4] Fix CodeQL warnings
- ExAllocatePoolWithTag is deprecated in Win10 2004, use ExAllocatePoolUninitialized instead Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> --- src/common/util.h | 4 ++++ src/xenvbd/adapter.c | 12 ++++-------- src/xenvbd/base64.c | 15 ++++----------- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/common/util.h b/src/common/util.h index eddad4a..36a36dd 100644 --- a/src/common/util.h +++ b/src/common/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; diff --git a/src/xenvbd/adapter.c b/src/xenvbd/adapter.c index 9fd2abc..5b17a6b 100644 --- a/src/xenvbd/adapter.c +++ b/src/xenvbd/adapter.c @@ -102,13 +102,9 @@ __AdapterAllocate( IN ULONG Size ) { - PVOID Buffer; - Buffer = ExAllocatePoolWithTag(NonPagedPool, - Size, - ADAPTER_POOL_TAG); - if (Buffer) - RtlZeroMemory(Buffer, Size); - return Buffer; + return __AllocatePoolWithTag(NonPagedPool, + Size, + ADAPTER_POOL_TAG); } static FORCEINLINE VOID @@ -116,7 +112,7 @@ __AdapterFree( IN PVOID Buffer ) { - ExFreePoolWithTag(Buffer, ADAPTER_POOL_TAG); + __FreePoolWithTag(Buffer, ADAPTER_POOL_TAG); } static FORCEINLINE PANSI_STRING diff --git a/src/xenvbd/base64.c b/src/xenvbd/base64.c index 0e62784..223579a 100644 --- a/src/xenvbd/base64.c +++ b/src/xenvbd/base64.c @@ -44,15 +44,9 @@ Base64Allocate( IN ULONG Size ) { - PVOID Buffer; - - Buffer = ExAllocatePoolWithTag(NonPagedPool, - Size, - BASE64_POOL_TAG); - if (Buffer) - RtlZeroMemory(Buffer, Size); - - return Buffer; + return __AllocatePoolWithTag(NonPagedPool, + Size, + BASE64_POOL_TAG); } VOID @@ -60,8 +54,7 @@ Base64Free( IN PVOID Buffer ) { - if (Buffer) - ExFreePoolWithTag(Buffer, BASE64_POOL_TAG); + __FreePoolWithTag(Buffer, BASE64_POOL_TAG); } static FORCEINLINE UCHAR -- 2.31.1.windows.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |