[<prev] [next>] [day] [month] [year] [list]
Message-ID: <776348e8d2b844068bbe23ce67d23f7a@huawei.com>
Date: Fri, 21 Feb 2020 01:36:31 +0000
From: linmiaohe <linmiaohe@...wei.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>
CC: "kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"rkrcmar@...hat.com" <rkrcmar@...hat.com>,
"wanpengli@...cent.com" <wanpengli@...cent.com>,
"jmattson@...gle.com" <jmattson@...gle.com>,
"joro@...tes.org" <joro@...tes.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "hpa@...or.com" <hpa@...or.com>
Subject: Re: [PATCH] KVM: apic: avoid calculating pending eoi from an
uninitialized val
Sean Christopherson <sean.j.christopherson@...el.com> wrote:
>On Thu, Feb 20, 2020 at 05:33:17PM +0100, Vitaly Kuznetsov wrote:
>> linmiaohe <linmiaohe@...wei.com> writes:
>>
>
>Rather than initialize @val, I'd prefer to explicitly handle the error, similar to pv_eoi_clr_pending() and pv_eoi_set_pending(), e.g.
>
> u8 val;
>
> if (pv_eoi_get_user(vcpu, &val) < 0) {
> printk(KERN_WARNING "Can't read EOI MSR value: 0x%llx\n",
> (unsigned long long)vcpu->arch.pv_eoi.msr_val);
> return false;
> }
> return val & 0x1;
Looks good. Handle the error explicitly can help remind us @val is unusable.
Will do. Thanks.
>> > if (pv_eoi_get_user(vcpu, &val) < 0)
>> > printk(KERN_WARNING "Can't read EOI MSR value: 0x%llx\n",
>> > (unsigned long long)vcpu->arch.pv_eoi.msr_val);
>>
>> Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>
>>
>> But why compilers don't complain?
>
>Clang might?
>
Powered by blists - more mailing lists