From: Oliver Kurth Date: Tue, 27 Aug 2019 19:55:38 +0000 (-0700) Subject: More Coverity annotations for open-vm-tools. X-Git-Tag: stable-11.1.0~254 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eb3c8515aa5a12c506acb8924b34b22fa018165;p=thirdparty%2Fopen-vm-tools.git More Coverity annotations for open-vm-tools. 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. --- diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c index 774ec4198..0b99e159e 100644 --- a/open-vm-tools/lib/file/file.c +++ b/open-vm-tools/lib/file/file.c @@ -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); diff --git a/open-vm-tools/lib/include/vmci_sockets.h b/open-vm-tools/lib/include/vmci_sockets.h index 6b4f45f22..0171cdbe6 100644 --- a/open-vm-tools/lib/include/vmci_sockets.h +++ b/open-vm-tools/lib/include/vmci_sockets.h @@ -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; } diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 2c4758b63..6352b9151 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -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); }