ia64/xen-unstable

changeset 18855:00a15b45cae3

Fix the HVM save hypercall to avoid freeing an uninitalised pointer.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Dec 03 15:54:24 2008 +0000 (2008-12-03)
parents 2647c63be4cf
children 5c121966ad9a
files xen/arch/x86/domctl.c
line diff
     1.1 --- a/xen/arch/x86/domctl.c	Wed Dec 03 15:12:19 2008 +0000
     1.2 +++ b/xen/arch/x86/domctl.c	Wed Dec 03 15:54:24 2008 +0000
     1.3 @@ -326,13 +326,9 @@ long arch_do_domctl(
     1.4  
     1.5      case XEN_DOMCTL_sethvmcontext:
     1.6      { 
     1.7 -        struct hvm_domain_context c;
     1.8 -        struct domain             *d;
     1.9 +        struct hvm_domain_context c = { .size = domctl->u.hvmcontext.size };
    1.10 +        struct domain *d;
    1.11  
    1.12 -        c.cur = 0;
    1.13 -        c.size = domctl->u.hvmcontext.size;
    1.14 -        c.data = NULL;
    1.15 -        
    1.16          ret = -ESRCH;
    1.17          if ( (d = rcu_lock_domain_by_id(domctl->domain)) == NULL )
    1.18              break;
    1.19 @@ -367,8 +363,8 @@ long arch_do_domctl(
    1.20  
    1.21      case XEN_DOMCTL_gethvmcontext:
    1.22      { 
    1.23 -        struct hvm_domain_context c;
    1.24 -        struct domain             *d;
    1.25 +        struct hvm_domain_context c = { 0 };
    1.26 +        struct domain *d;
    1.27  
    1.28          ret = -ESRCH;
    1.29          if ( (d = rcu_lock_domain_by_id(domctl->domain)) == NULL )
    1.30 @@ -382,9 +378,7 @@ long arch_do_domctl(
    1.31          if ( !is_hvm_domain(d) ) 
    1.32              goto gethvmcontext_out;
    1.33  
    1.34 -        c.cur = 0;
    1.35          c.size = hvm_save_size(d);
    1.36 -        c.data = NULL;
    1.37  
    1.38          if ( guest_handle_is_null(domctl->u.hvmcontext.buffer) )
    1.39          {