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

[PATCH 17/18] xencrsh: Suppress a C6385 false positive in __DumpBytes


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Fri, 16 Oct 2026 15:26:54 +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: Fri, 16 Oct 2026 13:27:13 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

ThisTime is min(Length - Index, 8), so every read in the switch stays
below Length, but code analysis loses that bound through the switch
and reports C6385. Suppress the warning around the loop, with a comment
saying why.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xencrsh/pdoinquiry.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/xencrsh/pdoinquiry.c b/src/xencrsh/pdoinquiry.c
index 97db301..8993046 100644
--- a/src/xencrsh/pdoinquiry.c
+++ b/src/xencrsh/pdoinquiry.c
@@ -635,6 +635,10 @@ __DumpBytes(
 {
     ULONG       ThisTime, Index;
 
+    // ThisTime = min(Length - Index, 8): reads stay below Length.
+    // The analyzer loses that bound through the switch (C6385 false positive).
+#pragma warning(push)
+#pragma warning(disable: 6385)
     for (Index = 0; Index < Length; ) {
         ThisTime = __Min(Length - Index, 8);
         switch (ThisTime) {
@@ -675,6 +679,7 @@ __DumpBytes(
         }
         Index += ThisTime;
     }
+#pragma warning(pop)
 }
 static FORCEINLINE VOID
 __DumpPage(
-- 
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®.