]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mem_sharing: fix uninitialized 'preempted' variable
authorTamas K Lengyel <tamas@tklengyel.com>
Mon, 18 Jan 2021 17:23:06 +0000 (10:23 -0700)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 18 Jan 2021 17:50:11 +0000 (17:50 +0000)
UBSAN catches an uninitialized use of the 'preempted' variable in
fork_hap_allocation when there is no preemption.

Fixes: 41548c5472a ("mem_sharing: VM forking")
Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm/mem_sharing.c

index c8a6d11b90c4429fb6f8a4836bc7cd96d19e0684..adaeab461235f3cd514d8fab9a07706f362b5a38 100644 (file)
@@ -1644,7 +1644,7 @@ static int copy_vcpu_settings(struct domain *cd, const struct domain *d)
 static int fork_hap_allocation(struct domain *cd, struct domain *d)
 {
     int rc;
-    bool preempted;
+    bool preempted = false;
     unsigned long mb = hap_get_allocation(d);
 
     if ( mb == hap_get_allocation(cd) )