diff mbox series

x86/mem_sharing: fix uninitialized 'preempted' variable

Message ID b52103fa0c7450735586b8576b8070409c86ea24.1610990339.git.tamas@tklengyel.com (mailing list archive)
State New, archived
Headers show
Series x86/mem_sharing: fix uninitialized 'preempted' variable | expand

Commit Message

Tamas K Lengyel Jan. 18, 2021, 5:23 p.m. UTC
UBSAN catches an uninitialized use of the 'preempted' variable in
fork_hap_allocation when there is no preemption.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/mm/mem_sharing.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Cooper Jan. 18, 2021, 5:25 p.m. UTC | #1
On 18/01/2021 17:23, Tamas K Lengyel wrote:
> 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>
diff mbox series

Patch

diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
index c8a6d11b90..adaeab4612 100644
--- a/xen/arch/x86/mm/mem_sharing.c
+++ b/xen/arch/x86/mm/mem_sharing.c
@@ -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) )