From: Owen Smith Date: Tue, 10 Aug 2021 15:40:48 +0000 (+0100) Subject: Fix issues raised by CodeQL (part 1) X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b0160349d92830753412a017c4e9fa481e172c15;p=pvdrivers%2Fwin%2Fxenbus.git Fix issues raised by CodeQL (part 1) - 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 Split up original patch. Signed-off-by: Paul Durrant --- diff --git a/src/common/util.h b/src/common/util.h index eddad4a..36a36dd 100644 --- a/src/common/util.h +++ b/src/common/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;