]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
More Coverity annotations for open-vm-tools.
authorOliver Kurth <okurth@vmware.com>
Tue, 27 Aug 2019 19:55:38 +0000 (12:55 -0700)
committerOliver Kurth <okurth@vmware.com>
Tue, 27 Aug 2019 19:55:38 +0000 (12:55 -0700)
Add Coverity annotations for four additional issues so that Coverity
scans of open-vm-tools will automatically classify these issues as
"intentional."  Such annotations are useful both for internal use as
well as for partners who run Coverity scans of open-vm-tools.

open-vm-tools/lib/file/file.c
open-vm-tools/lib/include/vmci_sockets.h
open-vm-tools/services/plugins/vix/vixTools.c

index 774ec41981cd3158a35054cac2bd11c182122cce..0b99e159eeeb5a36380c77e563ebc4f7137ab47e 100644 (file)
@@ -640,6 +640,12 @@ FileLockGetMachineID(void)
       if (q == NULL) {
          p = Util_SafeStrdup(GetOldMachineID());
       } else {
+
+         /*
+          * Coverity flags this as dead code on Non-Windows, non-Apple
+          * Platforms, since q will be NULL and this code not reached.
+          */
+         /* coverity[dead_error_begin] */
          p = Str_SafeAsprintf(NULL, "uuid=%s", q);
          Posix_Free(q);
 
index 6b4f45f2238296344aa0986c7ad586991d738431..0171cdbe6306166ea39181cffab2d218c6f934ca 100644 (file)
@@ -710,6 +710,11 @@ struct uuid_2_cid {
          *outFd = fd;
       }
 
+      /*
+       * The above comment explains why fd is left open even when outFd
+       * is NULL.
+       */
+      /* coverity[leaked_handle] */
       return family;
    }
 
index 2c4758b6322042751be68d81b773f8f6ca0a5d48..6352b9151a20163e92642afa06ee86876ed86f3b 100644 (file)
@@ -11747,6 +11747,12 @@ done:
 
    if (VIX_OK != err) {
       if (impersonated) {
+
+         /*
+          * Coverity flags this as dead code on non-Windows platforms,
+          * where impersonated can't be TRUE if VIX_OK != err.
+          */
+         /* coverity[dead_error_begin] */
          vgErr = VGAuth_EndImpersonation(ctx);
          ASSERT(vgErr == VGAUTH_E_OK);
       }
@@ -11906,6 +11912,12 @@ done:
 
    if (VIX_OK != err) {
       if (impersonated) {
+
+         /*
+          * Coverity flags this as dead code on non-Windows platforms,
+          * where impersonated can't be TRUE if VIX_OK != err.
+          */
+         /* coverity[dead_error_begin] */
          vgErr = VGAuth_EndImpersonation(ctx);
          ASSERT(vgErr == VGAUTH_E_OK);
       }