Re: [PATCH v4 4/7] Add network events to the remote driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



My overnight Coverity run found an issue in the function:

'remoteNetworkBuildEventLifecycle'

On 12/11/2013 05:38 AM, Cédric Bosdonnat wrote:
> ---
>  daemon/libvirtd.h            |   1 +
>  daemon/remote.c              | 139 +++++++++++++++++++++++++++++++++++++++++++
>  src/remote/remote_driver.c   | 127 +++++++++++++++++++++++++++++++++++++++
>  src/remote/remote_protocol.x |  46 +++++++++++++-
>  4 files changed, 312 insertions(+), 1 deletion(-)
> 
<...snip...>
>  
> +static void
> +remoteNetworkBuildEventLifecycle(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
> +                                 virNetClientPtr client ATTRIBUTE_UNUSED,
> +                                 void *evdata, void *opaque)
> +{
> +    virConnectPtr conn = opaque;
> +    struct private_data *priv = conn->privateData;
> +    remote_network_event_lifecycle_msg *msg = evdata;
> +    virNetworkPtr net;
> +    virObjectEventPtr event = NULL;
> +
> +    net = get_nonnull_network(conn, msg->net);
> +    if (!net)
> +        return;
> +

4920 	

(3) Event returned_null: 	Function "virNetworkEventLifecycleNew(char const *, unsigned char const *, int)" returns null (checked 10 out of 11 times). [details]
(14) Event var_assigned: 	Assigning: "event" = null return value from "virNetworkEventLifecycleNew(char const *, unsigned char const *, int)".
Also see events: 	[example_assign][example_checked][example_assign][example_checked][example_assign][example_checked][example_assign][example_checked][example_assign][example_checked][dereference]

4921 	    event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event);

> +    event = virNetworkEventLifecycleNew(net->name, net->uuid, msg->event);
> +    virNetworkFree(net);
> +

(15) Event dereference: 	Dereferencing a pointer that might be null "event" when calling "remoteDomainEventQueue(struct private_data *, virObjectEventPtr)". [details]
Also see events: 	[returned_null][example_assign][example_checked][example_assign][example_checked][example_assign][example_checked][example_assign][example_checked][example_assign][example_checked][var_assigned]


> +    remoteDomainEventQueue(priv, event);
> +}
> +
> +

Essentially - you need to check for NULL event.

John

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]