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

Re: [PATCH] Fix signed comparison in Mrsw.h



Looks good.

Acked-by: Owen Smith <owen.smith@xxxxxxxxx>

On Mon, Nov 25, 2024 at 1:05 PM Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx> wrote:
Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenvif/mrsw.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/xenvif/mrsw.h b/src/xenvif/mrsw.h
index f82d329..e1ff056 100644
--- a/src/xenvif/mrsw.h
+++ b/src/xenvif/mrsw.h
@@ -64,7 +64,7 @@ InitializeMrswLock(

     RtlZeroMemory(Lock, sizeof (XENVIF_MRSW_LOCK));

-    for (Slot = 0; Slot < sizeof (Lock->Mask) * 8; Slot++)
+    for (Slot = 0; Slot < (LONG) sizeof (Lock->Mask) * 8; Slot++)
         Lock->Holder[Slot].Level = -1;

     KeInitializeEvent(&Lock->Event, NotificationEvent, FALSE);
@@ -103,7 +103,7 @@ __AcquireMrswLockExclusive(
     Self = KeGetCurrentThread();

     // Make sure we do not already hold the lock
-    for (Slot = 0; Slot < sizeof (Lock->Mask) * 8; Slot++)
+    for (Slot = 0; Slot < (LONG) sizeof (Lock->Mask) * 8; Slot++)
         ASSERT(Lock->Holder[Slot].Thread != Self);

     for (;;) {
@@ -218,7 +218,7 @@ AcquireMrswLockShared(

     // Do we already hold the lock? If so, get the nesting level
     Level = -1;
-    for (Slot = 0; Slot < sizeof (Lock->Mask) * 8; Slot++) {
+    for (Slot = 0; Slot < (LONG) sizeof (Lock->Mask) * 8; Slot++) {
         if (Lock->Holder[Slot].Thread == Self && Lock->Holder[Slot].Level > Level)
             Level = Lock->Holder[Slot].Level;
     }
@@ -261,7 +261,7 @@ ReleaseMrswLockShared(

     Level = -1;
     Deepest = -1;
-    for (Slot = 0; Slot < sizeof (Lock->Mask) * 8; Slot++) {
+    for (Slot = 0; Slot < (LONG) sizeof (Lock->Mask) * 8; Slot++) {
         if (Lock->Holder[Slot].Thread == Self && Lock->Holder[Slot].Level > Level) {
             Level = Lock->Holder[Slot].Level;
             Deepest = Slot;
--
2.47.0.windows.2



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