[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <53F1D543.4060700@redhat.com>
Date: Mon, 18 Aug 2014 12:28:19 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Wanpeng Li <wanpeng.li@...ux.intel.com>
CC: Gleb Natapov <gleb@...nel.org>, hpa@...or.com, x86@...nel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org
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;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists