]> xenbits.xensource.com Git - pvdrivers/win/xenvkbd.git/commitdiff
Fix CodeQL warnings
authorPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 12:16:39 +0000 (13:16 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 12:16:39 +0000 (13:16 +0100)
- ExAllocatePoolWithTag is deprecated in Win10 2004, use
    ExAllocatePoolUninitialized instead

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Ported from other drivers.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
src/xenvkbd/fdo.c
src/xenvkbd/pdo.c
src/xenvkbd/util.h

index 109692a4aaa93e437d822a502d3ab01bd0e1dcd5..61949cf2a7a5547a3e9a6a1d3fb47b61522be154 100644 (file)
@@ -1853,7 +1853,7 @@ FdoQueryDeviceRelations(
 
     Size = FIELD_OFFSET(DEVICE_RELATIONS, Objects) + (sizeof (PDEVICE_OBJECT) * __max(Count, 1));
 
-    Relations = ExAllocatePoolWithTag(PagedPool, Size, 'FIV');
+    Relations = __AllocatePoolWithTag(PagedPool, Size, 'FIV');
 
     status = STATUS_NO_MEMORY;
     if (Relations == NULL)
index f0a383672d69828f9413c6ece9d3613c1fe17135..d1019104958b2e6469c3684c29b73bfc86b5fed3 100644 (file)
@@ -911,7 +911,7 @@ PdoQueryDeviceRelations(
     if (StackLocation->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
         goto done;
 
-    Relations = ExAllocatePoolWithTag(PagedPool, sizeof (DEVICE_RELATIONS), 'FIV');
+    Relations = __AllocatePoolWithTag(PagedPool, sizeof (DEVICE_RELATIONS), 'FIV');
 
     status = STATUS_NO_MEMORY;
     if (Relations == NULL)
@@ -1163,7 +1163,7 @@ PdoQueryDeviceText(
         goto done;
     }
 
-    Buffer = ExAllocatePoolWithTag(PagedPool, MAXTEXTLEN, 'FIV');
+    Buffer = __AllocatePoolWithTag(PagedPool, MAXTEXTLEN, 'FIV');
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
@@ -1291,7 +1291,7 @@ PdoQueryId(
         goto done;
     }
 
-    Buffer = ExAllocatePoolWithTag(PagedPool, Id.MaximumLength, 'FIV');
+    Buffer = __AllocatePoolWithTag(PagedPool, Id.MaximumLength, 'FIV');
 
     status = STATUS_NO_MEMORY;
     if (Buffer == NULL)
@@ -1427,7 +1427,7 @@ PdoQueryBusInformation(
 
     UNREFERENCED_PARAMETER(Pdo);
 
-    Info = ExAllocatePoolWithTag(PagedPool, sizeof (PNP_BUS_INFORMATION), 'FIV');
+    Info = __AllocatePoolWithTag(PagedPool, sizeof (PNP_BUS_INFORMATION), 'FIV');
 
     status = STATUS_NO_MEMORY;
     if (Info == NULL)
index f6ab77e504137a63a24db552b90e798dd5cddebc..71c2ff5c13137baedcfcd397a08326510f5cf8fc 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;