From: Radim Krčmář Date: Thu, 18 May 2017 17:37:30 +0000 (+0200) Subject: KVM: x86: zero base3 of unusable segments X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=f0367ee1d64d27fa08be2407df5c125442e885e3;p=openwrt%2Fstaging%2Fblogic.git KVM: x86: zero base3 of unusable segments Static checker noticed that base3 could be used uninitialized if the segment was not present (useable). Random stack values probably would not pass VMCS entry checks. Reported-by: Dan Carpenter Fixes: 1aa366163b8b ("KVM: x86 emulator: consolidate segment accessors") Reviewed-by: Paolo Bonzini Reviewed-by: David Hildenbrand Signed-off-by: Radim Krčmář --- diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 519f3572e48e..02363e37d4a6 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5067,6 +5067,8 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector, if (var.unusable) { memset(desc, 0, sizeof(*desc)); + if (base3) + *base3 = 0; return false; }