[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6 06/11] x86/vmce: emulate MSR_IA32_MCG_EXT_CTL
>>> On 06.07.17 at 04:03, <haozhong.zhang@xxxxxxxxx> wrote: > How is about generalize above two else cases by > > else if ( evc->size >= offsetof(typeof(*evc), mcg_cap) + > sizeof(evc->mcg_cap) ) > { > struct hvm_vmce_vcpu vmce = { }; > > memcpy(&vmce, &evc->vmce, > evc->size - offsetof(typeof(*evc), mcg_cap)); > ret = vmce_restore_vcpu(v, &vmce); > } Fundamentally yes, but as you say ... > However, I'm not sure whether it's safe to blindly copy what is passed > in 'evc->vmce'. Before this patch, the else-if branch only copies > mcg_cap if the size of evc->vmce is larger than the size of mcg_cap, > so it implies no? ... I think we ought to at least avoid copying partial fields. Hence I think the generalization would involve introduction of a table of sizes / boundaries at which the copied range may end. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |