[libvirt] [PATCH 09/10] libxl_migration: Resolve Coverity NULL_RETURNS

Ján Tomko jtomko at redhat.com
Wed Aug 27 14:42:55 UTC 2014


On 08/27/2014 03:51 PM, John Ferlan wrote:
> Coverity noted that all callers to libxlDomainEventQueue() could ensure
> the second parameter (event) was true before calling except this case.
> As I look at the code and how events are used - it seems that two events
> would have been sent which more than likely causes some bad stuff for
> the second one.  So just remove one call and let the cleanup: handle
> the event.  In the future if there's code between getting the event
> and cleanup that needs to send the event, this will have to change in
> order to send the event and set event = NULL (although it seems unlikely
> to happen).
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/libxl/libxl_migration.c | 1 -
>  1 file changed, 1 deletion(-)


> 
> diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
> index dbb5a8f..eb65536 100644
> --- a/src/libxl/libxl_migration.c
> +++ b/src/libxl/libxl_migration.c
> @@ -519,7 +519,6 @@ libxlDomainMigrationFinish(virConnectPtr dconn,
>          libxlDomainCleanup(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED);
>          event = virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STOPPED,
>                                           VIR_DOMAIN_EVENT_STOPPED_FAILED);

This (possibly) overwrites the event created earlier.
But I'm not sure if the right solution is to send both events, or clear the
original one.

Jan

> -        libxlDomainEventQueue(driver, event);
>      }
>  
>   cleanup:
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140827/48f549cd/attachment-0001.sig>


More information about the libvir-list mailing list