From: Oliver Kurth Date: Tue, 27 Aug 2019 19:55:37 +0000 (-0700) Subject: Add more Coverity annotations to open-vm-tools source. X-Git-Tag: stable-11.1.0~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=945dea136b2589f9522b06d262535032a77ee807;p=thirdparty%2Fopen-vm-tools.git Add more Coverity annotations to open-vm-tools source. 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. --- diff --git a/open-vm-tools/libvmtools/vmtoolsLog.c b/open-vm-tools/libvmtools/vmtoolsLog.c index 6043491d9..09ec0ff83 100644 --- a/open-vm-tools/libvmtools/vmtoolsLog.c +++ b/open-vm-tools/libvmtools/vmtoolsLog.c @@ -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 */ diff --git a/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c b/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c index 99a40a8c9..621820365 100644 --- a/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c +++ b/open-vm-tools/services/plugins/vix/foundryToolsDaemon.c @@ -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: diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 372b4639c..2c4758b63 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -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;