]> xenbits.xensource.com Git - pvdrivers/win/xencons.git/commitdiff
Fix CodeQL warnings
authorOwen Smith <owen.smith@citrix.com>
Thu, 12 Aug 2021 12:33:48 +0000 (13:33 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 09:05:32 +0000 (10:05 +0100)
- ExAllocatePoolWithTag is deprecated in Win10 2004, use
    ExAllocatePoolUninitialized instead

Signed-off-by: Owen Smith <owen.smith@citrix.com>
src/xencons/fdo.c
src/xencons/pdo.c
src/xencons/util.h

index 438f502beb8b0e71cb73cf1cc1eeffcf356bf1e4..99042494fd1b707f71afddf46bc6d26618ab8ce0 100644 (file)
@@ -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)
index b7177a90fdd906d745207d8340843de58af47ada..d7db389d82ca3f1d973250b6f97b648a7adcf22b 100644 (file)
@@ -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)
@@ -927,7 +927,7 @@ PdoQueryDeviceText(
         goto done;
     }
 
-    Buffer = ExAllocatePoolWithTag(PagedPool, MAXTEXTLEN, PDO_POOL);
+    Buffer = __AllocatePoolWithTag(PagedPool, MAXTEXTLEN, PDO_POOL);
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
@@ -1055,7 +1055,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)
@@ -1177,7 +1177,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)
index 9d88b8aa8b6d2e54bda1f6791af1403bb00340c7..9403891dc156e6bcc1f3be6b509da8b9754be333 100644 (file)
@@ -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;