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

[win-pv-devel] [PATCH] Fix VS2013 SDV failures



Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenvbd/buffer.c   |  1 +
 src/xenvbd/driver.c   |  4 +++-
 src/xenvbd/fdo.c      |  5 ++---
 src/xenvbd/pdo.c      |  1 +
 src/xenvbd/registry.c | 38 ++++++++++++++++++++++++--------------
 5 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/src/xenvbd/buffer.c b/src/xenvbd/buffer.c
index 029543e..6e35790 100644
--- a/src/xenvbd/buffer.c
+++ b/src/xenvbd/buffer.c
@@ -130,6 +130,7 @@ __IsOnList(
     ASSERT3U(KeGetCurrentIrql(), ==, DISPATCH_LEVEL);
 
     for (Entry = ListHead->Flink; Entry != ListHead; Entry = Entry->Flink) {
+        ASSERT3P(Entry, !=, NULL);
         if (Entry == ListItem) {
             Found = TRUE;
             break;
diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c
index 08f9b12..f5f73ca 100644
--- a/src/xenvbd/driver.c
+++ b/src/xenvbd/driver.c
@@ -120,10 +120,12 @@ __DriverGetSystemStartParams(
 
     RtlInitUnicodeString(&Unicode, L"SystemStartOptions");
     Status = ZwQueryValueKey(Key, &Unicode, KeyValuePartialInformation, NULL, 
0, &Size);
-    if (Status != STATUS_BUFFER_TOO_SMALL)
+    if (Status != STATUS_BUFFER_TOO_SMALL &&
+        Status != STATUS_BUFFER_OVERFLOW)
         goto fail2;
 
     Status = STATUS_NO_MEMORY;
+#pragma prefast(suppress:6102)
     Value = 
(PKEY_VALUE_PARTIAL_INFORMATION)__AllocateNonPagedPoolWithTag(__FUNCTION__, 
__LINE__, Size, XENVBD_POOL_TAG);
     if (Value == NULL)
         goto fail3;
diff --git a/src/xenvbd/fdo.c b/src/xenvbd/fdo.c
index 60d8cd9..f240a97 100644
--- a/src/xenvbd/fdo.c
+++ b/src/xenvbd/fdo.c
@@ -1211,7 +1211,7 @@ FdoDevicePower(
 }
 
 __checkReturn
-__drv_maxIRQL(DISPATCH_LEVEL)
+__drv_maxIRQL(PASSIVE_LEVEL)
 static NTSTATUS
 __FdoInitialize(
     __in PXENVBD_FDO             Fdo
@@ -1796,10 +1796,9 @@ FdoMapDeviceObjectToPdo(
     Status = __FdoExtractTargetId(String, &TargetId);
     if (NT_SUCCESS(Status)) {
         __FdoSetDeviceObject(Fdo, TargetId, DeviceObject);
+        Verbose("0x%p --> Target %d (%ws)\n", DeviceObject, TargetId, String);
     }
 
-    Verbose("0x%p --> Target %d (%ws)\n", DeviceObject, TargetId, String);
-
     // String is PagedPool, allocated by lower driver
     ASSERT3U(KeGetCurrentIrql(), <=, APC_LEVEL);
     ExFreePool(String);
diff --git a/src/xenvbd/pdo.c b/src/xenvbd/pdo.c
index 3f18621..76b0112 100644
--- a/src/xenvbd/pdo.c
+++ b/src/xenvbd/pdo.c
@@ -621,6 +621,7 @@ PdoDestroy(
                                  FALSE,
                                  NULL,
                                  WaitBlock);
+#pragma prefast(suppress:6102)
         __PdoFree(WaitBlock);
     }
 
diff --git a/src/xenvbd/registry.c b/src/xenvbd/registry.c
index 2308908..883bcb4 100644
--- a/src/xenvbd/registry.c
+++ b/src/xenvbd/registry.c
@@ -171,16 +171,16 @@ RegistryOpenHardwareKey(
         goto fail1;
 
     Length = 0;
-    (VOID) ZwQueryKey(SubKey,
-                      KeyNameInformation,
-                      NULL,
-                      0,
-                      &Length);
-
-    status = STATUS_INVALID_PARAMETER;
-    if (Length == 0)
+    status = ZwQueryKey(SubKey,
+                        KeyNameInformation,
+                        NULL,
+                        0,
+                        &Length);
+    if (status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
         goto fail2;
-    
+
+#pragma prefast(suppress:6102)
     Info = __RegistryAllocate(Length + sizeof (WCHAR));
 
     status = STATUS_NO_MEMORY;
@@ -365,9 +365,11 @@ RegistryEnumerateSubKeys(
                         NULL,
                         0,
                         &Size);
-    if (status != STATUS_BUFFER_TOO_SMALL)
+    if (status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
         goto fail1;
 
+#pragma prefast(suppress:6102)
     Full = __RegistryAllocate(Size);
 
     status = STATUS_NO_MEMORY;
@@ -466,9 +468,11 @@ RegistryEnumerateValues(
                         NULL,
                         0,
                         &Size);
-    if (status != STATUS_BUFFER_TOO_SMALL)
+    if (status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
         goto fail1;
 
+#pragma prefast(suppress:6102)
     Full = __RegistryAllocate(Size);
 
     status = STATUS_NO_MEMORY;
@@ -599,9 +603,11 @@ RegistryQueryDwordValue(
                              NULL,
                              0,
                              &Size);
-    if (status != STATUS_BUFFER_TOO_SMALL)
+    if (status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
         goto fail2;
 
+#pragma prefast(suppress:6102)
     Partial = __RegistryAllocate(Size);
 
     status = STATUS_NO_MEMORY;
@@ -824,9 +830,11 @@ RegistryQuerySzValue(
                              NULL,
                              0,
                              &Size);
-    if (status != STATUS_BUFFER_TOO_SMALL)
+    if (status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
         goto fail2;
 
+#pragma prefast(suppress:6102)
     Value = __RegistryAllocate(Size);
 
     status = STATUS_NO_MEMORY;
@@ -895,10 +903,12 @@ RegistryQueryKeyName(
                         NULL,
                         0,
                         &Size);
-    if (status != STATUS_BUFFER_TOO_SMALL)
+    if (status != STATUS_BUFFER_OVERFLOW &&
+        status != STATUS_BUFFER_TOO_SMALL)
         goto fail1;
 
     // Name information is not intrinsically NULL terminated
+#pragma prefast(suppress:6102)
     Value = __RegistryAllocate(Size + sizeof (WCHAR));
 
     status = STATUS_NO_MEMORY;
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.