]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Fix VS2013 SDV failures
authorPaul Durrant <paul.durrant@citrix.com>
Mon, 2 Mar 2015 13:08:12 +0000 (13:08 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Mon, 2 Mar 2015 13:08:12 +0000 (13:08 +0000)
A mis-annotation of some ZwQueryXXX operations is causing SDV to fail
when it notices code in registry.c using the length being passed back
from a failed call. The code is correct according to the documentation of
those functions so this patch suppresses the warnings.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/common/registry.c

index 81a20cf70e41de9d61dbfad666556be91a1dab5c..bfddbccd227f7afb52cdd2bb023bfdbc0ac037b4 100644 (file)
@@ -168,16 +168,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;
@@ -362,9 +362,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;
@@ -463,9 +465,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;
@@ -596,9 +600,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;
@@ -821,9 +827,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;
@@ -892,10 +900,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;