aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-08-20 16:11:42 +0200
committerJan Beulich <jbeulich@suse.com>2013-08-20 16:11:42 +0200
commit09cc1e255e8e4302d967223e6761ce1d1017b50d (patch)
treea31628ab60c34f40676b58706e77c87c608ae324
parent7c2dc5b8e80234153e7aaa32b9a511d0738bd39e (diff)
downloadxen-09cc1e255e8e4302d967223e6761ce1d1017b50d.tar.gz
xen-09cc1e255e8e4302d967223e6761ce1d1017b50d.tar.bz2
xen-09cc1e255e8e4302d967223e6761ce1d1017b50d.zip
x86/MTRR: fix range check in mtrr_add_page()
Extracted from Yinghai Lu's Linux commit d5c78673 ("x86: Fix /proc/mtrr with base/size more than 44bits"). Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Keir Fraser <keir@xen.org> master commit: f67af6d5803b6a015e30cb490a94f9547cb0437c master date: 2013-08-14 11:20:26 +0200
-rw-r--r--xen/arch/x86/cpu/mtrr/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xen/arch/x86/cpu/mtrr/main.c b/xen/arch/x86/cpu/mtrr/main.c
index 7438102882..3cad3a72f6 100644
--- a/xen/arch/x86/cpu/mtrr/main.c
+++ b/xen/arch/x86/cpu/mtrr/main.c
@@ -357,7 +357,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
return -EINVAL;
}
- if (base & size_or_mask || size & size_or_mask) {
+ if ((base | (base + size - 1)) >> (paddr_bits - PAGE_SHIFT)) {
printk(KERN_WARNING "mtrr: base or size exceeds the MTRR width\n");
return -EINVAL;
}