[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] Fix CodeQL warnings


  • To: <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Thu, 12 Aug 2021 13:33:48 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Owen Smith <owen.smith@xxxxxxxxxx>
  • Delivery-date: Thu, 12 Aug 2021 12:34:18 +0000
  • Ironport-hdrordr: A9a23:adQjBa51m1WOtmDlAAPXwWOBI+orL9Y04lQ7vn2ZFiY6TiXIra +TdaoguSMc0AxhIE3I6urwQ5VoIEmsuKKdjrNhW4tKMDOW21dAT7sSobcKoQeQYhEWn9Q1vc 0MEshD4bXLfB5HZK3BkWyF+qMbsb66GdeT9IPjJhlWPGNXgqdbhDtRO0K+KAlbVQNGDZ02GN 63/cxcvQetfnwRc4CSGmQFd/KrnayFqLvWJTo9QzI34giHij2lrJTgFQKD4xsYWzRThZ8/7G n+lRDj7KnLiYD09vac7R6T031loqqj9jJxPr3PtiHTEESotu+cXvUgZ1RFhkFwnAjg0idsrD CGmWZbAy060QKtQojym2q15+Co6kdT11byjVecmnfqrNzhXzQxB9BaiY8xSGqr12Mw+N57y6 5FxGSfqt5eCg7Bhj3045zSWwhtjVfcmwtqrQc/tQ0pbWIlUs4mkWXfxjIkLL4QWCbhrIw3Gu hnC8/RoP5QbFOBdnjc+m1i2salUHg/FgqPBhFqgL3f7xFG2HRii0cIzs0WmXkNsJo7Vplf/u zBdqBljqtHQMMaZb90QO0BXcy0AGrQRg+kChPbHX33UKUcf37doZ/+57s4oOmsZZwT1ZM33I /MVVtJ3FRCD34Gyff+qaGj1yq9CllVcQ6dtP221qIJyIEUHoCbThFrYGpe4vednw==
  • Ironport-sdr: lh8plFkd1uNYD62DnOMbxz8ZeY676rC6uoB3AgM7tYEOcTQa3qcA5UYDFnPLxlBX42VBx4NH7v pFxN1hES9Z8zI1xjY8RnV9sQlxHhsqqUuechqMcocft2RnsJc87+ifi/IwjtIIrYUerf5rn1jo dFYy1ahj1Rt+NKiMDuPpl/d2oJ2C6SAWgiD//xLvCtApvjqTCywwN/XYYoEiLuxVGcXelz9poL 4Lgu2FOcj6g4X2HJtd8xuko8gB94rTR9sPLLp/28c7HjPoCbkJwX+L0nqoLD5u4yxpjx14/6j7 CXvy5YtgAcP7e09ApPVW8oMZ
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

- 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.