Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752220AbdHBIOb (ORCPT ); Wed, 2 Aug 2017 04:14:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52938 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751901AbdHBIO3 (ORCPT ); Wed, 2 Aug 2017 04:14:29 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 68E311A3E4C Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH] KVM: X86: init irq->level in kvm_pv_kick_cpu_op To: "Longpeng(Mike)" , rkrcmar@redhat.com Cc: tglx@linutronix.de, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, weidong.huang@huawei.com, arei.gonglei@huawei.com, wangxinxin.wang@huawei.com References: <1501644051-211436-1-git-send-email-longpeng2@huawei.com> From: Paolo Bonzini Message-ID: Date: Wed, 2 Aug 2017 10:14:25 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501644051-211436-1-git-send-email-longpeng2@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 02 Aug 2017 08:14:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1430 Lines: 40 On 02/08/2017 05:20, Longpeng(Mike) wrote: > 'lapic_irq' is a local variable and its 'level' field isn't > initialized, so 'level' is random, it doesn't matter but > makes UBSAN unhappy: > > UBSAN: Undefined behaviour in .../lapic.c:... > load of value 10 is not a valid value for type '_Bool' > ... > Call Trace: > [] dump_stack+0x1e/0x20 > [] ubsan_epilogue+0x12/0x55 > [] __ubsan_handle_load_invalid_value+0x118/0x162 > [] kvm_apic_set_irq+0xc3/0xf0 [kvm] > [] kvm_irq_delivery_to_apic_fast+0x450/0x910 [kvm] > [] kvm_irq_delivery_to_apic+0xfa/0x7a0 [kvm] > [] kvm_emulate_hypercall+0x62e/0x760 [kvm] > [] handle_vmcall+0x1a/0x30 [kvm_intel] > [] vmx_handle_exit+0x7a2/0x1fa0 [kvm_intel] > ... > > Signed-off-by: Longpeng(Mike) > --- > arch/x86/kvm/x86.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 6c97c82..b411f92 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -6215,6 +6215,7 @@ static void kvm_pv_kick_cpu_op(struct kvm *kvm, unsigned long flags, int apicid) > > lapic_irq.shorthand = 0; > lapic_irq.dest_mode = 0; > + lapic_irq.level = 0; > lapic_irq.dest_id = apicid; > lapic_irq.msi_redir_hint = false; Looks good. Thanks, Paolo