summaryrefslogtreecommitdiff
path: root/arch/powerpc/kvm/emulate_loadstore.c
diff options
context:
space:
mode:
authorSimon Guo <wei.guo.simon@gmail.com>2018-05-07 14:20:09 +0800
committerPaul Mackerras <paulus@ozlabs.org>2018-05-18 15:38:23 +1000
commitf19d1f367a506bc645f8d6695942b8873fc82c84 (patch)
treec79ad46b444623354f4fa028a022946107e2165e /arch/powerpc/kvm/emulate_loadstore.c
parent173c520a049f57e2af498a3f0557d07797ce1c1b (diff)
KVM: PPC: Fix a mmio_host_swabbed uninitialized usage issue
When KVM emulates VMX store, it will invoke kvmppc_get_vmx_data() to retrieve VMX reg val. kvmppc_get_vmx_data() will check mmio_host_swabbed to decide which double word of vr[] to be used. But the mmio_host_swabbed can be uninitialized during VMX store procedure: kvmppc_emulate_loadstore \- kvmppc_handle_store128_by2x64 \- kvmppc_get_vmx_data So vcpu->arch.mmio_host_swabbed is not meant to be used at all for emulation of store instructions, and this patch makes that true for VMX stores. This patch also initializes mmio_host_swabbed to avoid possible future problems. Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch/powerpc/kvm/emulate_loadstore.c')
-rw-r--r--arch/powerpc/kvm/emulate_loadstore.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
index a382e15135e6..b8a3aefc3033 100644
--- a/arch/powerpc/kvm/emulate_loadstore.c
+++ b/arch/powerpc/kvm/emulate_loadstore.c
@@ -111,6 +111,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
vcpu->arch.mmio_sp64_extend = 0;
vcpu->arch.mmio_sign_extend = 0;
vcpu->arch.mmio_vmx_copy_nums = 0;
+ vcpu->arch.mmio_host_swabbed = 0;
switch (get_op(inst)) {
case 31: