Messages in this thread | | | Date | Mon, 18 Aug 2014 12:28:19 +0200 | From | Paolo Bonzini <> | Subject | Re: [PATCH 4/5] KVM: x86: fix check legal type of Variable Range MTRRs |
| |
Il 18/08/2014 11:50, Wanpeng Li ha scritto: > + if (msr >= 0x200 && msr < 0x200 + 2 * KVM_NR_VAR_MTRR) {
This should be a WARN_ON, and the base/mask can be separated just with an "&".
WARN_ON(!(msr >= 0x200 && msr < 0x200 + 2 * KVM_NR_VAR_MTRR));
if ((msr & 1) == 0) /* MTRR base */ return valid_mtrr_type(data & 0xff);
/* MTRR mask */ return true;
Please provide a unit test for this patch and for patch 1.
Paolo
> + int idx, is_mtrr_mask; > + > + idx = (msr - 0x200) / 2; > + is_mtrr_mask = msr - 0x200 - 2 * idx; > + if (!is_mtrr_mask) > + return valid_mtrr_type(data & 0xff); > + } > + return true; > }
| |