[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v11 01/11] x86/cpu: Introduce vmce_save_vcpu_ctxt_one() func



>>> On 13.07.18 at 11:04, <aisaila@xxxxxxxxxxxxxxx> wrote:
> Changes since V10:
>       - Add memset to 0 for ctxt.

Why? What's wrong with ...

> --- a/xen/arch/x86/cpu/mcheck/vmce.c
> +++ b/xen/arch/x86/cpu/mcheck/vmce.c
> @@ -349,6 +349,20 @@ int vmce_wrmsr(uint32_t msr, uint64_t val)
>      return ret;
>  }
>  
> +static int vmce_save_vcpu_ctxt_one(struct vcpu *v, hvm_domain_context_t *h)
> + {
> +    struct hvm_vmce_vcpu ctxt;
> +
> +    memset(&ctxt, 0, sizeof(ctxt));

    struct hvm_vmce_vcpu ctxt = {};

instead? Or even pulling all of this ...

> +    ctxt.caps = v->arch.vmce.mcg_cap;
> +    ctxt.mci_ctl2_bank0 = v->arch.vmce.bank[0].mci_ctl2;
> +    ctxt.mci_ctl2_bank1 = v->arch.vmce.bank[1].mci_ctl2;
> +    ctxt.mcg_ext_ctl = v->arch.vmce.mcg_ext_ctl;

... into the initializer, which will make sure padding fields are zero.
I can see that a memset() is warranted in _some_ cases, but not
uniformly.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.