]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Fix issues raised by CodeQL (part 1)
authorOwen Smith <owen.smith@citrix.com>
Tue, 10 Aug 2021 15:40:48 +0000 (16:40 +0100)
committerPaul Durrant <pdurrant@amazon.com>
Mon, 20 Sep 2021 07:45:44 +0000 (08:45 +0100)
- ExAllocatePoolWithTag is deprecated in Windows 10 2004 and replaced with
    ExAllocatePool2. Use ExAllocatePoolUninitialized to maintain support for
    earlier versions of Windows.

Signed-off-by: Owen Smith <owen.smith@citrix.com>
Split up original patch.

Signed-off-by: Paul Durrant <paul@xen.org>
src/common/util.h

index eddad4a8ea374d3f8873f0d57f75e173fd537309..36a36dd639ec61ab11ef3698521ade604d8f4778 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;