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

[PATCH 14/17] wmi: fix output buffer annotations


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Mon, 5 Oct 2026 17:59:01 +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>

We annotate in Utf8FromUtf32 and Utf16FromUtf32 the number of bytes that
is legal to write.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xeniface/wmi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/xeniface/wmi.c b/src/xeniface/wmi.c
index 8e3f002..d8e1a73 100644
--- a/src/xeniface/wmi.c
+++ b/src/xeniface/wmi.c
@@ -190,13 +190,13 @@ Utf32FromUtf8(
 
 static USHORT
 Utf16FromUtf32(
-    _Out_ PWCHAR    utf16,
-    _In_ ULONG      utf32
+    _Out_writes_(2) PWCHAR  utf16,
+    _In_ ULONG              utf32
     )
 {
-    WCHAR           u;
-    WCHAR           w;
-    WCHAR           x;
+    WCHAR                   u;
+    WCHAR                   w;
+    WCHAR                   x;
 
     if ((utf32 > 0xFFFF)) {
         u = (utf32 & 0x1F0000) >> 16;
@@ -237,14 +237,14 @@ CountUtf16FromUtf32(
 
 static USHORT
 Utf8FromUtf32(
-    _Out_ PCHAR dest,
-    _In_ ULONG  utf32
+    _Out_writes_(4) PCHAR   dest,
+    _In_ ULONG              utf32
     )
 {
-    CHAR        u;
-    CHAR        y;
-    CHAR        x;
-    CHAR        z;
+    CHAR                    u;
+    CHAR                    y;
+    CHAR                    x;
+    CHAR                    z;
 
     if (utf32 & UTF8MASK4) {
         x = utf32 & 0x3f;
-- 
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®.