[libvirt] [PATCH 0/4] Remove need for STATIC_ANALYSIS in viralloc.h

Ján Tomko jtomko at redhat.com
Thu May 19 16:08:17 UTC 2016


On Wed, May 18, 2016 at 08:07:52AM -0400, John Ferlan wrote:
> Not sure which release exactly, but the coverity analysis bug I filed that
> was the reason for commit id 'c9a85af31' has been fixed, so it's time to
> remove that... In doing so uncovered another issue - it seems the fix for
> Coverity addressed the primary problem we've seen, but when there's functions
> returning allocated strings by reference that can also VIR_FREE(*string),
> whatever was added to address the main issue doesn't seem to recognize this
> other usage, resulinting in a false positive resource_leak. Luckily there's
> only two instances in our code for that. One is addressed by patch 3 and
> the other in virPCIDeviceGetDriverPathAndName which would require quite
> a few more changes to address (essentially split up the function - it'll
> be on my "to do" list).
> 
> Patch 1:
> Addresses an issue seen once patches 2-4 were applied - that there's a
> real problem with the error path.  It's a simple fix.
> 
> Patches 2 & 3:
> Address a false positive resource leak even with patch 4 applied.
> 
> Patch 4:
> Remove the rather ugly !STATIC_ANALYSIS within the VIR_FREE and VIR_DISPOSE*
> macros. As I found with a build after the fact, VIR_DISPOSE_STRING was missing
> an argument anyway (it should have been ": 0, 1, NULL" instead of ": 1, NULL").
> 

Nice to see it go.

> NB: Patch 4 has been run through the private coverity server...
> 
> John Ferlan (4):
>   util: Fix error path for virPCIGetVirtualFunctions
>   util: Remove need for ret in virPCIGetPhysicalFunction
>   util: Adjust return for virPCIGetDeviceAddressFromSysfsLink
>   util: Remove need for STATIC_ANALYSIS check
> 
>  src/util/viralloc.h | 34 ++++++----------------------------
>  src/util/virpci.c   | 39 +++++++++++++++++++--------------------
>  2 files changed, 25 insertions(+), 48 deletions(-)
> 

ACK series

Jan




More information about the libvir-list mailing list