ia64/xen-unstable

changeset 12717:697b0203e68f

[XEN] Fix error paths in p2m insertion code
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Dec 01 09:28:14 2006 +0000 (2006-12-01)
parents 952c2cddff0c
children 2801a14d169a 260426e3924f
files xen/arch/x86/mm/shadow/common.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/common.c	Thu Nov 30 20:16:54 2006 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/common.c	Fri Dec 01 09:28:14 2006 +0000
     1.3 @@ -1008,12 +1008,13 @@ shadow_set_p2m_entry(struct domain *d, u
     1.4      void *table = sh_map_domain_page(table_mfn);
     1.5      unsigned long gfn_remainder = gfn;
     1.6      l1_pgentry_t *p2m_entry;
     1.7 +    int rv=0;
     1.8  
     1.9  #if CONFIG_PAGING_LEVELS >= 4
    1.10      if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn,
    1.11                           L4_PAGETABLE_SHIFT - PAGE_SHIFT,
    1.12                           L4_PAGETABLE_ENTRIES, PGT_l3_page_table) )
    1.13 -        return 0;
    1.14 +        goto out;
    1.15  #endif
    1.16  #if CONFIG_PAGING_LEVELS >= 3
    1.17      // When using PAE Xen, we only allow 33 bits of pseudo-physical
    1.18 @@ -1027,12 +1028,12 @@ shadow_set_p2m_entry(struct domain *d, u
    1.19                            ? 8
    1.20                            : L3_PAGETABLE_ENTRIES),
    1.21                           PGT_l2_page_table) )
    1.22 -        return 0;
    1.23 +        goto out;
    1.24  #endif
    1.25      if ( !p2m_next_level(d, &table_mfn, &table, &gfn_remainder, gfn,
    1.26                           L2_PAGETABLE_SHIFT - PAGE_SHIFT,
    1.27                           L2_PAGETABLE_ENTRIES, PGT_l1_page_table) )
    1.28 -        return 0;
    1.29 +        goto out;
    1.30  
    1.31      p2m_entry = p2m_find_entry(table, &gfn_remainder, gfn,
    1.32                                 0, L1_PAGETABLE_ENTRIES);
    1.33 @@ -1051,9 +1052,12 @@ shadow_set_p2m_entry(struct domain *d, u
    1.34          (void)__shadow_validate_guest_entry(
    1.35              d->vcpu[0], table_mfn, p2m_entry, sizeof(*p2m_entry));
    1.36  
    1.37 +    /* Success */
    1.38 +    rv = 1;
    1.39 + 
    1.40 + out:
    1.41      sh_unmap_domain_page(table);
    1.42 -
    1.43 -    return 1;
    1.44 +    return rv;
    1.45  }
    1.46  
    1.47  // Allocate a new p2m table for a domain.