[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] Fix CodeQL warnings
- To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
- From: Paul Durrant <xadimgnik@xxxxxxxxx>
- Date: Mon, 20 Sep 2021 10:37:01 +0100
- Delivery-date: Mon, 20 Sep 2021 09:37:04 +0000
- List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
On 20/09/2021 10:34, Paul Durrant wrote:
On 12/08/2021 13:41, Owen Smith wrote:
- 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);
We'll still need to zero the memory to maintain the semantics, right?
Oh, my mistake... it's already done.
Acked-by: Paul Durrant <paul@xxxxxxx>
|