Re: [PATCH 4/5] KVM: x86: fix check legal type of Variable Range MTRRs

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

 



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;
>  }

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux