Skip to contentSkip to conversation

x86/pv: Use xmemdup() for cpuidmasks, rather than opencoding it

PATCH In review Andrew Cooper 4 participants 4 messages Aug 15, 2018 – Aug 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/pv: Use xmemdup() for cpuidmasks, rather than opencoding it

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/pv/domain.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
xen/arch/x86/pv/domain.c +3 -7
index 3230ac6..52108d4 100644
@@ -240,13 +240,9 @@ int pv_domain_initialise(struct domain *d)
         goto fail;
     clear_page(d->arch.pv_domain.gdt_ldt_l1tab);
 
-    if ( levelling_caps & ~LCAP_faulting )
-    {
-        d->arch.pv_domain.cpuidmasks = xmalloc(struct cpuidmasks);
-        if ( !d->arch.pv_domain.cpuidmasks )
-            goto fail;
-        *d->arch.pv_domain.cpuidmasks = cpuidmask_defaults;
-    }
+    if ( levelling_caps & ~LCAP_faulting &&
+         (d->arch.pv_domain.cpuidmasks = xmemdup(&cpuidmask_defaults)) == NULL )
+        goto fail;
 
     rc = create_perdomain_mapping(d, GDT_LDT_VIRT_START,
                                   GDT_LDT_MBYTES << (20 - PAGE_SHIFT),
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel