[libvirt] [PATCH] xen: Resolve Coverity FORWARD_NULL issue
Eric Blake
eblake at redhat.com
Thu May 23 21:22:32 UTC 2013
On 05/23/2013 09:20 AM, John Ferlan wrote:
> Commit '18b14012' refactored the Xen code resulting in a Coverity
> warning about possible NULL reference if the path where the XM driver
> takes puts the def on it's list. Moved/duplicated the virGetDomain()
> call to pacify the possible NULL deref.
>
> NOTE: I did ping Dan B, but he is away, so rather than wait or take
> the chance this ends up in the upcoming release, I made the change.
Drop the NOTE when committing (it has bearing on the review, but not on
the patch contents, so it would have fit better after the ---).
>
> ---
> src/xen/xen_driver.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> index cc6e486..9eab3fc 100644
> --- a/src/xen/xen_driver.c
> +++ b/src/xen/xen_driver.c
> @@ -1658,13 +1658,14 @@ xenUnifiedDomainDefineXML(virConnectPtr conn, const char *xml)
> if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> if (xenXMDomainDefineXML(conn, def) < 0)
> goto cleanup;
> + ret = virGetDomain(conn, def->name, def->uuid);
> def = NULL; /* XM driver owns it now */
> } else {
> if (xenDaemonDomainDefineXML(conn, def) < 0)
> goto cleanup;
> + ret = virGetDomain(conn, def->name, def->uuid);
> }
>
> - ret = virGetDomain(conn, def->name, def->uuid);
ACK; definite use-after-free fixup.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130523/b3b8ebdc/attachment-0001.sig>
More information about the libvir-list
mailing list