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

[PATCH 13/17] ioctl: fix annotation of __CaptureUserBuffer


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Mon, 5 Oct 2026 17:59:00 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Cc: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Delivery-date: Mon, 05 Oct 2026 15:59:38 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

*CapturedBuffer can be both Null or filled with Buffer on success path,
so depending on the passed Length of the buffer that needs to be captured
we annotate *CapturedBuffer accordingly.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xeniface/ioctls.c | 4 +++-
 src/xeniface/ioctls.h | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/xeniface/ioctls.c b/src/xeniface/ioctls.c
index dec68d7..f9c959e 100644
--- a/src/xeniface/ioctls.c
+++ b/src/xeniface/ioctls.c
@@ -44,7 +44,9 @@ NTSTATUS
 __CaptureUserBuffer(
     _In_ PVOID      Buffer,
     _In_ ULONG      Length,
-    _Outptr_ PVOID  *CapturedBuffer
+    _When_(Length != 0, _Outptr_result_bytebuffer_(Length))
+    _When_(Length == 0, _Outptr_result_maybenull_)
+    PVOID           *CapturedBuffer
     )
 {
     NTSTATUS        Status;
diff --git a/src/xeniface/ioctls.h b/src/xeniface/ioctls.h
index 71d74d3..59e186f 100644
--- a/src/xeniface/ioctls.h
+++ b/src/xeniface/ioctls.h
@@ -93,7 +93,9 @@ NTSTATUS
 __CaptureUserBuffer(
     _In_ PVOID      Buffer,
     _In_ ULONG      Length,
-    _Outptr_ PVOID  *CapturedBuffer
+    _When_(Length != 0, _Outptr_result_bytebuffer_(Length))
+    _When_(Length == 0, _Outptr_result_maybenull_)
+    PVOID           *CapturedBuffer
     );
 
 VOID
-- 
2.55.0.windows.5



--
Césaire Mounah | Vates Windows Guest Tools Engineer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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