|
[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
Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
src/xencons/fdo.c | 2 +-
src/xencons/pdo.c | 8 ++++----
src/xencons/util.h | 4 ++++
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/xencons/fdo.c b/src/xencons/fdo.c
index 438f502..9904249 100644
--- a/src/xencons/fdo.c
+++ b/src/xencons/fdo.c
@@ -1794,7 +1794,7 @@ FdoQueryDeviceRelations(
Size = FIELD_OFFSET(DEVICE_RELATIONS, Objects) + (sizeof(PDEVICE_OBJECT) *
__max(Count, 1));
- Relations = ExAllocatePoolWithTag(PagedPool, Size, FDO_POOL);
+ Relations = __AllocatePoolWithTag(PagedPool, Size, FDO_POOL);
status = STATUS_NO_MEMORY;
if (Relations == NULL)
diff --git a/src/xencons/pdo.c b/src/xencons/pdo.c
index e8dcebd..827c7cb 100644
--- a/src/xencons/pdo.c
+++ b/src/xencons/pdo.c
@@ -809,7 +809,7 @@ PdoQueryDeviceRelations(
if (StackLocation->Parameters.QueryDeviceRelations.Type !=
TargetDeviceRelation)
goto done;
- Relations = ExAllocatePoolWithTag(PagedPool, sizeof(DEVICE_RELATIONS),
PDO_POOL);
+ Relations = __AllocatePoolWithTag(PagedPool, sizeof(DEVICE_RELATIONS),
PDO_POOL);
status = STATUS_NO_MEMORY;
if (Relations == NULL)
@@ -931,7 +931,7 @@ PdoQueryDeviceText(
goto done;
}
- Buffer = ExAllocatePoolWithTag(PagedPool, MAXTEXTLEN, PDO_POOL);
+ Buffer = __AllocatePoolWithTag(PagedPool, MAXTEXTLEN, PDO_POOL);
status = STATUS_NO_MEMORY;
if (Buffer == NULL)
@@ -1061,7 +1061,7 @@ PdoQueryId(
goto done;
}
- Buffer = ExAllocatePoolWithTag(PagedPool, Id.MaximumLength, PDO_POOL);
+ Buffer = __AllocatePoolWithTag(PagedPool, Id.MaximumLength, PDO_POOL);
status = STATUS_NO_MEMORY;
if (Buffer == NULL)
@@ -1185,7 +1185,7 @@ PdoQueryBusInformation(
UNREFERENCED_PARAMETER(Pdo);
- Info = ExAllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION),
PDO_POOL);
+ Info = __AllocatePoolWithTag(PagedPool, sizeof(PNP_BUS_INFORMATION),
PDO_POOL);
status = STATUS_NO_MEMORY;
if (Info == NULL)
diff --git a/src/xencons/util.h b/src/xencons/util.h
index 9d88b8a..9403891 100644
--- a/src/xencons/util.h
+++ b/src/xencons/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 |