>>> On 07.08.18 at 17:02, <aisa...@bitdefender.com> 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@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to