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

[PATCH 06/21] xenvif: Annotate buffer and array parameters with their sizes


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Mon, 12 Oct 2026 12:23:18 +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, 12 Oct 2026 10:23:58 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

Some pointer parameters that refer to buffers or arrays were annotated
as single elements.
We annotate them with the size they actually have: _bytes_ variants
where the size is a byte count, element variants where it is an
element count.

No functional change.

Assisted-by: Claude/Opus-5.5
Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xenvif/assert.h      |  18 ++---
 src/xenvif/bus.c         |  24 +++----
 src/xenvif/checksum.c    |   8 +--
 src/xenvif/checksum.h    |   6 +-
 src/xenvif/controller.c  |  38 +++++------
 src/xenvif/controller.h  |  14 ++--
 src/xenvif/fdo.c         |  20 +++---
 src/xenvif/fdo.h         |  20 +++---
 src/xenvif/frontend.c    |  26 +++----
 src/xenvif/frontend.h    |   6 +-
 src/xenvif/parse.c       | 142 +++++++++++++++++++--------------------
 src/xenvif/pdo.c         |  20 +++---
 src/xenvif/pdo.h         |  20 +++---
 src/xenvif/receiver.c    |  24 +++----
 src/xenvif/registry.c    |  20 +++---
 src/xenvif/registry.h    |  16 ++---
 src/xenvif/transmitter.c |  18 ++---
 src/xenvif/vif.c         |  12 ++--
 18 files changed, 226 insertions(+), 226 deletions(-)

diff --git a/src/xenvif/assert.h b/src/xenvif/assert.h
index e3b2c49..bf66d52 100644
--- a/src/xenvif/assert.h
+++ b/src/xenvif/assert.h
@@ -154,13 +154,13 @@ __Bug(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    _In_ PCSTR      Caller,
-    _In_ PCSTR      Name,
-    _In_ PVOID      Buffer,
-    _In_ ULONG      Length
+    _In_ PCSTR                      Caller,
+    _In_ PCSTR                      Name,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Length
     )
 {
-    ULONG           Offset;
+    ULONG                           Offset;
 
     Offset = 0;
     while (Offset < Length) {
@@ -178,10 +178,10 @@ _IsZeroMemory(
 
 static __inline BOOLEAN
 _IsZeroMemory(
-    _In_ PCSTR  Caller,
-    _In_ PCSTR  Name,
-    _In_ PVOID  Buffer,
-    _In_ ULONG  Length
+    _In_ PCSTR                      Caller,
+    _In_ PCSTR                      Name,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Length
     )
 {
     UNREFERENCED_PARAMETER(Caller);
diff --git a/src/xenvif/bus.c b/src/xenvif/bus.c
index 07e8c24..d8217d3 100644
--- a/src/xenvif/bus.c
+++ b/src/xenvif/bus.c
@@ -126,14 +126,14 @@ static
 _Function_class_(GET_SET_DEVICE_DATA)
 ULONG
 BusSetData(
-    _In_ PVOID          _Context,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PVOID                      _Context,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     )
 {
-    PXENVIF_BUS_CONTEXT Context = _Context;
+    PXENVIF_BUS_CONTEXT             Context = _Context;
 
     return PdoSetBusData(Context->Pdo,
                          DataType,
@@ -146,14 +146,14 @@ static
 _Function_class_(GET_SET_DEVICE_DATA)
 ULONG
 BusGetData(
-    _In_ PVOID          _Context,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PVOID                      _Context,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     )
 {
-    PXENVIF_BUS_CONTEXT Context = _Context;
+    PXENVIF_BUS_CONTEXT             Context = _Context;
 
     return PdoGetBusData(Context->Pdo,
                          DataType,
diff --git a/src/xenvif/checksum.c b/src/xenvif/checksum.c
index eb2ed8d..8f85f49 100644
--- a/src/xenvif/checksum.c
+++ b/src/xenvif/checksum.c
@@ -47,12 +47,12 @@
 #if !defined(_M_X64)
 VOID
 AccumulateChecksum(
-    _Inout_ PULONG  Accumulator,
-    _In_ PUCHAR     BaseVa,
-    _In_ ULONG      ByteCount
+    _Inout_ PULONG                      Accumulator,
+    _In_reads_bytes_(ByteCount) PUCHAR  BaseVa,
+    _In_ ULONG                          ByteCount
     )
 {
-    ULONG           Current;
+    ULONG                               Current;
 
     Current = *Accumulator;
 
diff --git a/src/xenvif/checksum.h b/src/xenvif/checksum.h
index 5cd23a8..c2658ba 100644
--- a/src/xenvif/checksum.h
+++ b/src/xenvif/checksum.h
@@ -37,9 +37,9 @@
 
 extern VOID
 AccumulateChecksum(
-    _Inout_ PULONG  Accumulator,
-    _In_ PVOID      MappedSystemVa,
-    _In_ ULONG      ByteCount
+    _Inout_ PULONG                      Accumulator,
+    _In_reads_bytes_(ByteCount) PVOID   MappedSystemVa,
+    _In_ ULONG                          ByteCount
     );
 
 extern USHORT
diff --git a/src/xenvif/controller.c b/src/xenvif/controller.c
index 215a8f3..95fdae6 100644
--- a/src/xenvif/controller.c
+++ b/src/xenvif/controller.c
@@ -935,17 +935,17 @@ fail1:
 _IRQL_requires_(DISPATCH_LEVEL)
 NTSTATUS
 ControllerSetHashKey(
-    _Out_ PXENVIF_CONTROLLER    Controller,
-    _In_ PUCHAR                 Key,
-    _In_ ULONG                  Size
+    _Out_ PXENVIF_CONTROLLER        Controller,
+    _In_reads_bytes_(Size) PUCHAR   Key,
+    _In_ ULONG                      Size
     )
 {
-    PXENVIF_FRONTEND            Frontend;
-    PMDL                        Mdl;
-    PUCHAR                      Buffer;
-    PFN_NUMBER                  Pfn;
-    PXENBUS_GNTTAB_ENTRY        Entry;
-    NTSTATUS                    status;
+    PXENVIF_FRONTEND                Frontend;
+    PMDL                            Mdl;
+    PUCHAR                          Buffer;
+    PFN_NUMBER                      Pfn;
+    PXENBUS_GNTTAB_ENTRY            Entry;
+    NTSTATUS                        status;
 
     Frontend = Controller->Frontend;
 
@@ -1112,18 +1112,18 @@ fail1:
 _IRQL_requires_(DISPATCH_LEVEL)
 NTSTATUS
 ControllerSetHashMapping(
-    _Out_ PXENVIF_CONTROLLER    Controller,
-    _In_ PULONG                 Mapping,
-    _In_ ULONG                  Size,
-    _In_ ULONG                  Offset
+    _Out_ PXENVIF_CONTROLLER        Controller,
+    _In_reads_bytes_(Size) PULONG   Mapping,
+    _In_ ULONG                      Size,
+    _In_ ULONG                      Offset
     )
 {
-    PXENVIF_FRONTEND            Frontend;
-    PMDL                        Mdl;
-    PUCHAR                      Buffer;
-    PFN_NUMBER                  Pfn;
-    PXENBUS_GNTTAB_ENTRY        Entry;
-    NTSTATUS                    status;
+    PXENVIF_FRONTEND                Frontend;
+    PMDL                            Mdl;
+    PUCHAR                          Buffer;
+    PFN_NUMBER                      Pfn;
+    PXENBUS_GNTTAB_ENTRY            Entry;
+    NTSTATUS                        status;
 
     Frontend = Controller->Frontend;
 
diff --git a/src/xenvif/controller.h b/src/xenvif/controller.h
index ab6314c..39eab1f 100644
--- a/src/xenvif/controller.h
+++ b/src/xenvif/controller.h
@@ -107,9 +107,9 @@ ControllerSetHashFlags(
 _IRQL_requires_(DISPATCH_LEVEL)
 extern NTSTATUS
 ControllerSetHashKey(
-    _Out_ PXENVIF_CONTROLLER    Controller,
-    _In_ PUCHAR                 Key,
-    _In_ ULONG                  Size
+    _Out_ PXENVIF_CONTROLLER        Controller,
+    _In_reads_bytes_(Size) PUCHAR   Key,
+    _In_ ULONG                      Size
     );
 
 _IRQL_requires_(DISPATCH_LEVEL)
@@ -129,10 +129,10 @@ ControllerSetHashMappingSize(
 _IRQL_requires_(DISPATCH_LEVEL)
 extern NTSTATUS
 ControllerSetHashMapping(
-    _Out_ PXENVIF_CONTROLLER    Controller,
-    _In_ PULONG                 Mapping,
-    _In_ ULONG                  Size,
-    _In_ ULONG                  Offset
+    _Out_ PXENVIF_CONTROLLER        Controller,
+    _In_reads_bytes_(Size) PULONG   Mapping,
+    _In_ ULONG                      Size,
+    _In_ ULONG                      Offset
     );
 
 
diff --git a/src/xenvif/fdo.c b/src/xenvif/fdo.c
index 91e4141..78ac65a 100644
--- a/src/xenvif/fdo.c
+++ b/src/xenvif/fdo.c
@@ -372,11 +372,11 @@ FdoTranslateBusAddress(
 
 ULONG
 FdoSetBusData(
-    _In_ PXENVIF_FDO        Fdo,
-    _In_ ULONG              DataType,
-    _In_ PVOID              Buffer,
-    _In_ ULONG              Offset,
-    _In_ ULONG              Length
+    _In_ PXENVIF_FDO                Fdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     )
 {
     PBUS_INTERFACE_STANDARD BusInterface;
@@ -393,11 +393,11 @@ FdoSetBusData(
 
 ULONG
 FdoGetBusData(
-    _In_ PXENVIF_FDO        Fdo,
-    _In_ ULONG              DataType,
-    _In_ PVOID              Buffer,
-    _In_ ULONG              Offset,
-    _In_ ULONG              Length
+    _In_ PXENVIF_FDO                Fdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     )
 {
     PBUS_INTERFACE_STANDARD BusInterface;
diff --git a/src/xenvif/fdo.h b/src/xenvif/fdo.h
index 72017b7..4d1da49 100644
--- a/src/xenvif/fdo.h
+++ b/src/xenvif/fdo.h
@@ -101,20 +101,20 @@ FdoTranslateBusAddress(
 
 extern ULONG
 FdoSetBusData(
-    _In_ PXENVIF_FDO    Fdo,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PXENVIF_FDO                Fdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     );
 
 extern ULONG
 FdoGetBusData(
-    _In_ PXENVIF_FDO    Fdo,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PXENVIF_FDO                Fdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     );
 
 extern NTSTATUS
diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c
index be0fccd..a35ed78 100644
--- a/src/xenvif/frontend.c
+++ b/src/xenvif/frontend.c
@@ -1138,20 +1138,20 @@ fail1:
 _IRQL_requires_max_(DISPATCH_LEVEL)
 NTSTATUS
 FrontendSetMulticastAddresses(
-    _In_ PXENVIF_FRONTEND       Frontend,
-    _Inout_ PETHERNET_ADDRESS   Address,
-    _In_ ULONG                  Count
+    _In_ PXENVIF_FRONTEND               Frontend,
+    _In_reads_(Count) PETHERNET_ADDRESS Address,
+    _In_ ULONG                          Count
     )
 {
-    PXENVIF_TRANSMITTER         Transmitter;
-    PXENVIF_MAC                 Mac;
-    KIRQL                       Irql;
-    PETHERNET_ADDRESS           MulticastAddress;
-    ULONG                       MulticastCount;
-    ULONG                       MulticastIndex;
-    ULONG                       Index;
-    BOOLEAN                     Change;
-    NTSTATUS                    status;
+    PXENVIF_TRANSMITTER                 Transmitter;
+    PXENVIF_MAC                         Mac;
+    KIRQL                               Irql;
+    PETHERNET_ADDRESS                   MulticastAddress;
+    ULONG                               MulticastCount;
+    ULONG                               MulticastIndex;
+    ULONG                               Index;
+    BOOLEAN                             Change;
+    NTSTATUS                            status;
 
     Transmitter = FrontendGetTransmitter(Frontend);
     Mac = FrontendGetMac(Frontend);
@@ -2242,7 +2242,7 @@ _IRQL_requires_max_(DISPATCH_LEVEL)
 NTSTATUS
 FrontendSetHashMapping(
     _Out_ PXENVIF_FRONTEND  Frontend,
-    _In_ PULONG             Mapping,
+    _In_reads_(Size) PULONG Mapping,
     _In_ ULONG              Size
     )
 {
diff --git a/src/xenvif/frontend.h b/src/xenvif/frontend.h
index 41a9f10..4da8b3d 100644
--- a/src/xenvif/frontend.h
+++ b/src/xenvif/frontend.h
@@ -198,9 +198,9 @@ FrontendIncrementStatistic(
 _IRQL_requires_max_(DISPATCH_LEVEL)
 extern NTSTATUS
 FrontendSetMulticastAddresses(
-    _In_ PXENVIF_FRONTEND       Frontend,
-    _Inout_ PETHERNET_ADDRESS   Address,
-    _In_ ULONG                  Count
+    _In_ PXENVIF_FRONTEND               Frontend,
+    _In_reads_(Count) PETHERNET_ADDRESS Address,
+    _In_ ULONG                          Count
     );
 
 _IRQL_requires_max_(DISPATCH_LEVEL)
diff --git a/src/xenvif/parse.c b/src/xenvif/parse.c
index 4b860e6..2cfb117 100644
--- a/src/xenvif/parse.c
+++ b/src/xenvif/parse.c
@@ -46,13 +46,13 @@
 
 static FORCEINLINE BOOLEAN
 __ParsePullup(
-    _In_ XENVIF_PARSE_PULLUP    Pullup,
-    _In_ PVOID                  Argument,
-    _In_ PUCHAR                 StartVa,
-    _In_ ULONG                  StartLen,
-    _In_ ULONG                  Offset,
-    _In_ PXENVIF_PACKET_PAYLOAD Payload,
-    _In_ ULONG                  Length
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ PXENVIF_PACKET_PAYLOAD             Payload,
+    _In_ ULONG                              Length
     )
 {
     ASSERT3U(StartLen, >, Offset);
@@ -68,16 +68,16 @@ __ParsePullup(
 
 static FORCEINLINE NTSTATUS
 __ParseTcpHeader(
-    _In_ PUCHAR                         StartVa,
-    _In_ ULONG                          StartLen,
-    _In_ ULONG                          Offset,
-    _In_ XENVIF_PARSE_PULLUP            Pullup,
-    _In_ PVOID                          Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
-    _Out_ PXENVIF_PACKET_INFO           Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
-    PTCP_HEADER                         Header;
+    PTCP_HEADER                             Header;
 
     Info->TcpHeader.Offset = Offset;
 
@@ -138,13 +138,13 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __ParseUdpHeader(
-    _In_ PUCHAR                     StartVa,
-    _In_ ULONG                      StartLen,
-    _In_ ULONG                      Offset,
-    _In_ XENVIF_PARSE_PULLUP        Pullup,
-    _In_ PVOID                      Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD  Payload,
-    _Out_ PXENVIF_PACKET_INFO       Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
     Info->UdpHeader.Offset = Offset;
@@ -174,19 +174,19 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __ParseIpVersion4Header(
-    _In_ PUCHAR                         StartVa,
-    _In_ ULONG                          StartLen,
-    _In_ ULONG                          Offset,
-    _In_ XENVIF_PARSE_PULLUP            Pullup,
-    _In_ PVOID                          Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
-    _Out_ PXENVIF_PACKET_INFO           Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
-    PIPV4_HEADER                        Header;
-    USHORT                              PacketLength;
-    USHORT                              FragmentOffsetAndFlags;
-    NTSTATUS                            status;
+    PIPV4_HEADER                            Header;
+    USHORT                                  PacketLength;
+    USHORT                                  FragmentOffsetAndFlags;
+    NTSTATUS                                status;
 
     Info->IpHeader.Offset = Offset;
 
@@ -289,21 +289,21 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __ParseIpVersion6Header(
-    _In_ PUCHAR                         StartVa,
-    _In_ ULONG                          StartLen,
-    _In_ ULONG                          Offset,
-    _In_ XENVIF_PARSE_PULLUP            Pullup,
-    _In_ PVOID                          Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
-    _Out_ PXENVIF_PACKET_INFO           Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
-    PIPV6_HEADER                        Header;
-    USHORT                              PayloadLength;
-    UCHAR                               NextHeader;
-    ULONG                               Count;
-    BOOLEAN                             Finished;
-    NTSTATUS                            status;
+    PIPV6_HEADER                            Header;
+    USHORT                                  PayloadLength;
+    UCHAR                                   NextHeader;
+    ULONG                                   Count;
+    BOOLEAN                                 Finished;
+    NTSTATUS                                status;
 
     Info->IpHeader.Offset = Offset;
 
@@ -493,16 +493,16 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __ParseLLCSnapHeader(
-    _In_ PUCHAR                         StartVa,
-    _In_ ULONG                          StartLen,
-    _In_ ULONG                          Offset,
-    _In_ XENVIF_PARSE_PULLUP            Pullup,
-    _In_ PVOID                          Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
-    _Out_ PXENVIF_PACKET_INFO           Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
-    PLLC_SNAP_HEADER                    Header;
+    PLLC_SNAP_HEADER                        Header;
 
     Info->LLCSnapHeader.Offset = Offset;
 
@@ -552,19 +552,19 @@ fail1:
 
 static FORCEINLINE NTSTATUS
 __ParseEthernetHeader(
-    _In_ PUCHAR                         StartVa,
-    _In_ ULONG                          StartLen,
-    _In_ ULONG                          Offset,
-    _In_ XENVIF_PARSE_PULLUP            Pullup,
-    _In_ PVOID                          Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
-    _Out_ PXENVIF_PACKET_INFO           Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ ULONG                              Offset,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
-    PETHERNET_HEADER                    Header;
-    USHORT                              TypeOrLength;
-    BOOLEAN                             IsLLC;
-    NTSTATUS                            status;
+    PETHERNET_HEADER                        Header;
+    USHORT                                  TypeOrLength;
+    BOOLEAN                                 IsLLC;
+    NTSTATUS                                status;
 
     Info->EthernetHeader.Offset = Offset;
 
@@ -656,12 +656,12 @@ fail1:
 
 NTSTATUS
 ParsePacket(
-    _In_ PUCHAR                     StartVa,
-    _In_ ULONG                      StartLen,
-    _In_ XENVIF_PARSE_PULLUP        Pullup,
-    _In_ PVOID                      Argument,
-    _Inout_ PXENVIF_PACKET_PAYLOAD  Payload,
-    _Out_ PXENVIF_PACKET_INFO       Info
+    _Inout_updates_bytes_(StartLen) PUCHAR  StartVa,
+    _In_ ULONG                              StartLen,
+    _In_ XENVIF_PARSE_PULLUP                Pullup,
+    _In_ PVOID                              Argument,
+    _Inout_ PXENVIF_PACKET_PAYLOAD          Payload,
+    _Out_ PXENVIF_PACKET_INFO               Info
     )
 {
     ASSERT(IsZeroMemory(Info, sizeof (XENVIF_PACKET_INFO)));
diff --git a/src/xenvif/pdo.c b/src/xenvif/pdo.c
index e8c9067..18ffe7a 100644
--- a/src/xenvif/pdo.c
+++ b/src/xenvif/pdo.c
@@ -926,11 +926,11 @@ PdoTranslateBusAddress(
 
 ULONG
 PdoSetBusData(
-    _In_ PXENVIF_PDO    Pdo,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PXENVIF_PDO                Pdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     )
 {
     Trace("<===>\n");
@@ -944,11 +944,11 @@ PdoSetBusData(
 
 ULONG
 PdoGetBusData(
-    _In_ PXENVIF_PDO    Pdo,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PXENVIF_PDO                Pdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     )
 {
     Trace("<===>\n");
diff --git a/src/xenvif/pdo.h b/src/xenvif/pdo.h
index 517183a..cb1f8ef 100644
--- a/src/xenvif/pdo.h
+++ b/src/xenvif/pdo.h
@@ -112,20 +112,20 @@ PdoTranslateBusAddress(
 
 extern ULONG
 PdoSetBusData(
-    _In_ PXENVIF_PDO    Pdo,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PXENVIF_PDO                Pdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     );
 
 extern ULONG
 PdoGetBusData(
-    _In_ PXENVIF_PDO    Pdo,
-    _In_ ULONG          DataType,
-    _In_ PVOID          Buffer,
-    _In_ ULONG          Offset,
-    _In_ ULONG          Length
+    _In_ PXENVIF_PDO                Pdo,
+    _In_ ULONG                      DataType,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Offset,
+    _In_ ULONG                      Length
     );
 
 extern PETHERNET_ADDRESS
diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index 7ddb1e2..b25d84d 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -648,13 +648,13 @@ ReceiverRingProcessChecksum(
 
 static BOOLEAN
 ReceiverRingPullup(
-    _In_ PVOID                      Argument,
-    _Inout_ PUCHAR                  DestinationVa,
-    _Inout_ PXENVIF_PACKET_PAYLOAD  Payload,
-    _In_ ULONG                      Length
+    _In_ PVOID                          Argument,
+    _Out_writes_bytes_(Length) PUCHAR   DestinationVa,
+    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
+    _In_ ULONG                          Length
     )
 {
-    PMDL                            Mdl;
+    PMDL                                Mdl;
 
     Mdl = Payload->Mdl;
     ASSERT3U(Payload->Offset, ==, 0);
@@ -4009,15 +4009,15 @@ fail1:
 _IRQL_requires_(DISPATCH_LEVEL)
 static FORCEINLINE NTSTATUS
 __ReceiverSetQueueAffinities(
-    _In_ PXENVIF_RECEIVER   Receiver,
-    _In_ PPROCESSOR_NUMBER  QueueAffinities,
-    _In_ ULONG              Count
+    _In_ PXENVIF_RECEIVER               Receiver,
+    _In_reads_(Count) PPROCESSOR_NUMBER QueueAffinities,
+    _In_ ULONG                          Count
     )
 {
-    PXENVIF_FRONTEND        Frontend;
-    ULONG                   Index;
-    NTSTATUS                status;
-    KIRQL                   Irql;
+    PXENVIF_FRONTEND                    Frontend;
+    ULONG                               Index;
+    NTSTATUS                            status;
+    KIRQL                               Irql;
 
     Frontend = Receiver->Frontend;
 
diff --git a/src/xenvif/registry.c b/src/xenvif/registry.c
index 4586079..76bfddb 100644
--- a/src/xenvif/registry.c
+++ b/src/xenvif/registry.c
@@ -1155,17 +1155,17 @@ fail1:
 
 NTSTATUS
 RegistryQueryBinaryValue(
-    _In_ HANDLE                     Key,
-    _In_ PSTR                       Name,
-    _Outptr_ PVOID                  *Buffer,
-    _Out_ PULONG                    Length
+    _In_ HANDLE                             Key,
+    _In_ PSTR                               Name,
+    _Outptr_result_buffer_(*Length) PVOID   *Buffer,
+    _Out_ PULONG                            Length
     )
 {
-    ANSI_STRING                     Ansi;
-    UNICODE_STRING                  Unicode;
-    PKEY_VALUE_PARTIAL_INFORMATION  Partial;
-    ULONG                           Size;
-    NTSTATUS                        status;
+    ANSI_STRING                             Ansi;
+    UNICODE_STRING                          Unicode;
+    PKEY_VALUE_PARTIAL_INFORMATION          Partial;
+    ULONG                                   Size;
+    NTSTATUS                                status;
 
     RtlInitAnsiString(&Ansi, Name);
 
@@ -1242,7 +1242,7 @@ NTSTATUS
 RegistryUpdateBinaryValue(
     _In_ HANDLE                     Key,
     _In_ PSTR                       Name,
-    _In_ PVOID                      Buffer,
+    _In_reads_bytes_(Length) PVOID  Buffer,
     _In_ ULONG                      Length
     )
 {
diff --git a/src/xenvif/registry.h b/src/xenvif/registry.h
index b77e4fb..c9a5488 100644
--- a/src/xenvif/registry.h
+++ b/src/xenvif/registry.h
@@ -165,18 +165,18 @@ RegistryQuerySzValue(
 
 extern NTSTATUS
 RegistryQueryBinaryValue(
-    _In_ HANDLE     Key,
-    _In_ PSTR       Name,
-    _Outptr_ PVOID  *Buffer,
-    _Out_ PULONG    Length
+    _In_ HANDLE                             Key,
+    _In_ PSTR                               Name,
+    _Outptr_result_buffer_(*Length) PVOID   *Buffer,
+    _Out_ PULONG                            Length
     );
 
 extern NTSTATUS
 RegistryUpdateBinaryValue(
-    _In_ HANDLE Key,
-    _In_ PSTR   Name,
-    _In_ PVOID  Buffer,
-    _In_ ULONG  Length
+    _In_ HANDLE                     Key,
+    _In_ PSTR                       Name,
+    _In_reads_bytes_(Length) PVOID  Buffer,
+    _In_ ULONG                      Length
     );
 
 extern NTSTATUS
diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index 2549162..aff06b7 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -788,14 +788,14 @@ TransmitterRingDebugCallback(
 
 static BOOLEAN
 TransmitterPullup(
-    _In_ PVOID                      Argument,
-    _Inout_ PUCHAR                  DestinationVa,
-    _Inout_ PXENVIF_PACKET_PAYLOAD  Payload,
-    _In_ ULONG                      Length
+    _In_ PVOID                          Argument,
+    _Out_writes_bytes_(Length) PUCHAR   DestinationVa,
+    _Inout_ PXENVIF_PACKET_PAYLOAD      Payload,
+    _In_ ULONG                          Length
     )
 {
-    PMDL                            Mdl;
-    ULONG                           Offset;
+    PMDL                                Mdl;
+    ULONG                               Offset;
 
     UNREFERENCED_PARAMETER(Argument);
 
@@ -5073,9 +5073,9 @@ TransmitterTeardown(
 
 static FORCEINLINE VOID
 __TransmitterHashAccumulate(
-    _Inout_ PULONG  Accumulator,
-    _In_ PUCHAR     Array,
-    _In_ ULONG      Length
+    _Inout_ PULONG                  Accumulator,
+    _In_reads_bytes_(Length) PUCHAR Array,
+    _In_ ULONG                      Length
     )
 {
     ULONG           Current;
diff --git a/src/xenvif/vif.c b/src/xenvif/vif.c
index 279df15..c8dc446 100644
--- a/src/xenvif/vif.c
+++ b/src/xenvif/vif.c
@@ -840,14 +840,14 @@ VifMacQueryMulticastAddresses(
 
 static NTSTATUS
 VifMacSetMulticastAddresses(
-    _In_ PINTERFACE         Interface,
-    _Out_ PETHERNET_ADDRESS Address,
-    _In_ ULONG              Count
+    _In_ PINTERFACE                     Interface,
+    _In_reads_(Count) PETHERNET_ADDRESS Address,
+    _In_ ULONG                          Count
     )
 {
-    PXENVIF_VIF_CONTEXT     Context = Interface->Context;
-    ULONG                   Index;
-    NTSTATUS                status;
+    PXENVIF_VIF_CONTEXT                 Context = Interface->Context;
+    ULONG                               Index;
+    NTSTATUS                            status;
 
     status = STATUS_INVALID_PARAMETER;
     for (Index = 0; Index < Count; Index++) {
-- 
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®.