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

Re: [libvirt] [PATCH 4/5] xen: Need to check validity of domain->conn before deref privateData



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

Attachment: signature.asc
Description: OpenPGP digital signature


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