]> xenbits.xensource.com Git - pvdrivers/win/xenhid.git/commitdiff
Fix CodeQL warnings
authorPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 12:05:47 +0000 (13:05 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 12:06:23 +0000 (13:06 +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/xenhid/fdo.c
src/xenhid/util.h

index 04d3d7f36664566f95066042c61145a0dd8a7990..1df6900a38dd41a73390d347fb647e364f94dd57 100644 (file)
@@ -214,7 +214,7 @@ __FdoAllocate(
 {
     PVOID       Buffer;
 
-    Buffer = ExAllocatePoolWithTag(NonPagedPool, Length, FDO_POOL_TAG);
+    Buffer = __AllocatePoolWithTag(NonPagedPool, Length, FDO_POOL_TAG);
     if (Buffer)
         RtlZeroMemory(Buffer, Length);
 
@@ -226,7 +226,7 @@ __FdoFree(
     IN  PVOID   Buffer
     )
 {
-    ExFreePoolWithTag(Buffer, FDO_POOL_TAG);
+    __FreePoolWithTag(Buffer, FDO_POOL_TAG);
 }
 
 static FORCEINLINE VOID
index 4ade2dbf1595740afb37717f2267d2e3d58e8d75..55ee6b2f0ed33cb9a88f456631f7af960e998448 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;