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

[XENBUS PATCH] gnttab: Use for loop in GnttabRevokeForeignAccess


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Tue, 13 Oct 2026 11:58:42 +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:Feedback-ID"
  • Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Delivery-date: Tue, 13 Oct 2026 09:58:53 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

A while (Attempt++ < 100) loop leaves the final value at 101 after it
fails, because the value is checked before it's incremented.

Just use a normal for loop instead, which leaves the final Attempt at
100.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenbus/gnttab.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/xenbus/gnttab.c b/src/xenbus/gnttab.c
index 3adcef4..bdf8b2b 100644
--- a/src/xenbus/gnttab.c
+++ b/src/xenbus/gnttab.c
@@ -571,8 +571,7 @@ GnttabRevokeForeignAccess(
 
     flags = (volatile SHORT *)&Frame->Entry[Index].flags;
 
-    Attempt = 0;
-    while (Attempt++ < 100) {
+    for (Attempt = 0; Attempt < 100; Attempt++) {
         uint16_t    Old;
         uint16_t    New;
 
-- 
2.55.0.windows.3



--
Ngoc Tu Dinh | Vates XCP-ng Developer

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®.