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

open-vm-tools/libvmtools/vmtoolsLog.c
open-vm-tools/services/plugins/vix/foundryToolsDaemon.c
open-vm-tools/services/plugins/vix/vixTools.c

index 6043491d9b799488311cd5e03ea8b4684bc5df50..09ec0ff83f941abd379372e20b4458c73a188d34 100644 (file)
@@ -882,6 +882,11 @@ VMToolsGetLogFilePath(const gchar *key,
    if (len == 0) {
       g_warning("Invalid path for domain '%s'.", domain);
       g_free(origPath);
+      /*
+       * Coverity flags this as a possible copy-paste error but assigning
+       * to path rather than origPath is correct.
+       */
+      /* coverity[copy_paste_error] */
       path = NULL;
    } else {
       /* Drop the trailing '"' chars */
index 99a40a8c91e7d7adf0d7bc0f8dc5d6f07bb586b3..6218203651e841e5e38d2f4fd7c604366b323320 100644 (file)
@@ -767,6 +767,12 @@ ToolsDaemonCheckMountedHGFS(Bool isFuseEnabled,      // IN:
          break;
       }
    }
+   /*
+    * Coverity flags this invocation of CLOSE_MNTFILE because the macro does
+    * a test whose results are ignored.  However, it also has a needed side
+    * effect, so this invocation is correct.
+    */
+   /* coverity[no_effect_test] */
    CLOSE_MNTFILE(mtab);
 
 exit:
index 372b4639c6dc4881bd04572d619cf08b72f1f08e..2c4758b6322042751be68d81b773f8f6ca0a5d48 100644 (file)
@@ -8969,6 +8969,12 @@ VixToolsListFileSystems(VixCommandRequestHeader *requestMsg, // IN
          goto abort;
       }
    }
+   /*
+    * Coverity flags this invocation of CLOSE_MNTFILE because the macro does
+    * a test whose results are ignored.  However, it also has a needed side
+    * effect, so this invocation is correct.
+    */
+   /* coverity[no_effect_test] */
    CLOSE_MNTFILE(fp);
 #else
    err = VIX_E_NOT_SUPPORTED;