[libvirt] [PATCH 4/5] xen: Need to check validity of domain->conn before deref privateData
Eric Blake
eblake at redhat.com
Tue Jan 15 22:48:22 UTC 2013
On 01/15/2013 11:35 AM, John Ferlan wrote:
> ---
> src/xen/xen_hypervisor.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
> index a770f53..ded1f0a 100644
> --- a/src/xen/xen_hypervisor.c
> +++ b/src/xen/xen_hypervisor.c
> @@ -3284,7 +3284,7 @@ xenHypervisorGetDomainState(virDomainPtr domain,
> int *reason,
> unsigned int flags)
> {
> - xenUnifiedPrivatePtr priv = domain->conn->privateData;
> + xenUnifiedPrivatePtr priv;
> virDomainInfo info;
>
> virCheckFlags(0, -1);
> @@ -3292,6 +3292,7 @@ xenHypervisorGetDomainState(virDomainPtr domain,
> if (domain->conn == NULL)
> return -1;
>
> + priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
This should be another one of those cases like Dan mentioned for 2/5
where the caller guaranteed that domain->conn is valid, and we can get
rid of the duplicate sanity checking here.
--
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/20130115/f3061639/attachment-0001.sig>
More information about the libvir-list
mailing list