Messages in this thread | | | From | linmiaohe <> | Subject | Re: [PATCH] KVM: apic: avoid calculating pending eoi from an uninitialized val | Date | Fri, 21 Feb 2020 01:36:31 +0000 |
| |
Sean Christopherson <sean.j.christopherson@intel.com> wrote: >On Thu, Feb 20, 2020 at 05:33:17PM +0100, Vitaly Kuznetsov wrote: >> linmiaohe <linmiaohe@huawei.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@redhat.com> >> >> But why compilers don't complain? > >Clang might? >
| |