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

Re: [Xen-devel] [PATCH v15 06/14] x86/hvm: Introduce hvm_save_mtrr_msr_one func



>>> On 07.08.18 at 17:02, <aisaila@xxxxxxxxxxxxxxx> wrote:
>>  
>> > 
>> > -        hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr);
>> > +    memcpy(hw_mtrr.msr_mtrr_fixed, mtrr_state->fixed_ranges,
>> > NUM_FIXED_MSR);
>> You want to BUILD_BUG_ON() array sizes differing, and then use
>> sizeof() in the call to memcpy().
>> 
> In this case sizes are different:
> msr_mtrr_fixed[NUM_FIXED_MSR];
> fixed_ranges[NUM_FIXED_RANGES];
> #define NUM_FIXED_RANGES 88
> #define NUM_FIXED_MSR 11

The base type of msr_mtrr_fixed[] is uint64_t, while fixed_ranges[]'s
is uint8_t. I had specifically used sizeof() in my previous reply (instead
of ARRAY_SIZE()) to avoid exactly this kind of confusion.

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®.