|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 03/17] util: fix some annotations
* _InterlockedAdd() and _InterlockedSubstract() call InterlockedCompareExchange(Value, New, Old), however the signature of InterlockedCompareExchange is annotated as (_Inout_, _In_, _Out_)[1], so Value should be annotated as _Inout_ in these functions as Value could be updated. * __strtok_r() indirectly write in Buffer (*Context = Buffer, and later *Context = End). So Buffer should be annotated as _Inout_opt_. * functions using these are updated accordingly [1]: https://learn.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedcompareexchange Assisted-by: Claude/Opus-4 Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx> --- src/xeniface/fdo.c | 2 +- src/xeniface/util.h | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/xeniface/fdo.c b/src/xeniface/fdo.c index e3f9b4f..aba717b 100644 --- a/src/xeniface/fdo.c +++ b/src/xeniface/fdo.c @@ -530,7 +530,7 @@ __FdoFreeAnsi( static FORCEINLINE BOOLEAN __FdoMatchDistribution( _In_ PXENIFACE_FDO Fdo, - _In_ PCHAR Buffer + _Inout_ PCHAR Buffer ) { PCHAR Vendor; diff --git a/src/xeniface/util.h b/src/xeniface/util.h index 8c6a917..77daa07 100644 --- a/src/xeniface/util.h +++ b/src/xeniface/util.h @@ -108,8 +108,8 @@ __CpuId( static FORCEINLINE LONG __InterlockedAdd( - _In_ LONG *Value, - _In_ LONG Delta + _Inout_ LONG *Value, + _In_ LONG Delta ) { LONG New; @@ -125,8 +125,8 @@ __InterlockedAdd( static FORCEINLINE LONG __InterlockedSubtract( - _In_ LONG *Value, - _In_ LONG Delta + _Inout_ LONG *Value, + _In_ LONG Delta ) { LONG New; @@ -277,15 +277,15 @@ __FreePages( static FORCEINLINE PSTR __strtok_r( - _In_opt_ PSTR Buffer, - _In_ PSTR Delimiter, + _Inout_opt_ PSTR Buffer, + _In_ PSTR Delimiter, _When_(Buffer != NULL, _Outptr_) _When_(Buffer == NULL, _Inout_) - PSTR *Context + PSTR *Context ) { - PSTR Token; - PSTR End; + PSTR Token; + PSTR End; if (Buffer != NULL) *Context = Buffer; @@ -317,15 +317,15 @@ __strtok_r( static FORCEINLINE PWSTR __wcstok_r( - _In_opt_ PWSTR Buffer, - _In_ PWSTR Delimiter, + _In_opt_ PWSTR Buffer, + _In_ PWSTR Delimiter, _When_(Buffer != NULL, _Outptr_) _When_(Buffer == NULL, _Inout_) - PWSTR *Context + PWSTR *Context ) { - PWSTR Token; - PWSTR End; + PWSTR Token; + PWSTR End; if (Buffer != NULL) *Context = Buffer; -- 2.55.0.windows.5 -- Césaire Mounah | Vates Windows Guest Tools Engineer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |