* [PATCH] x86/MTRR: fix range check in mtrr_add_page()
@ 2013-08-13 15:45 Jan Beulich
2013-08-13 16:55 ` Andrew Cooper
2013-08-13 17:34 ` Keir Fraser
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2013-08-13 15:45 UTC (permalink / raw)
To: xen-devel; +Cc: Keir Fraser
[-- Attachment #1: Type: text/plain, Size: 545 bytes --]
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>
--- a/xen/arch/x86/cpu/mtrr/main.c
+++ b/xen/arch/x86/cpu/mtrr/main.c
@@ -340,7 +340,7 @@ int mtrr_add_page(unsigned long base, un
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;
}
[-- Attachment #2: x86-MTRR-add-page-check.patch --]
[-- Type: text/plain, Size: 587 bytes --]
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>
--- a/xen/arch/x86/cpu/mtrr/main.c
+++ b/xen/arch/x86/cpu/mtrr/main.c
@@ -340,7 +340,7 @@ int mtrr_add_page(unsigned long base, un
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;
}
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/MTRR: fix range check in mtrr_add_page()
2013-08-13 15:45 [PATCH] x86/MTRR: fix range check in mtrr_add_page() Jan Beulich
@ 2013-08-13 16:55 ` Andrew Cooper
2013-08-13 17:34 ` Keir Fraser
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2013-08-13 16:55 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel, Keir Fraser
[-- Attachment #1.1: Type: text/plain, Size: 793 bytes --]
On 13/08/13 16:45, Jan Beulich wrote:
> 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>
>
> --- a/xen/arch/x86/cpu/mtrr/main.c
> +++ b/xen/arch/x86/cpu/mtrr/main.c
> @@ -340,7 +340,7 @@ int mtrr_add_page(unsigned long base, un
> 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;
> }
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 1699 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/MTRR: fix range check in mtrr_add_page()
2013-08-13 15:45 [PATCH] x86/MTRR: fix range check in mtrr_add_page() Jan Beulich
2013-08-13 16:55 ` Andrew Cooper
@ 2013-08-13 17:34 ` Keir Fraser
1 sibling, 0 replies; 3+ messages in thread
From: Keir Fraser @ 2013-08-13 17:34 UTC (permalink / raw)
To: Jan Beulich, xen-devel
On 13/08/2013 16:45, "Jan Beulich" <JBeulich@suse.com> wrote:
> 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>
Acked-by: Keir Fraser <keir@xen.org>
> --- a/xen/arch/x86/cpu/mtrr/main.c
> +++ b/xen/arch/x86/cpu/mtrr/main.c
> @@ -340,7 +340,7 @@ int mtrr_add_page(unsigned long base, un
> 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;
> }
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-13 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-13 15:45 [PATCH] x86/MTRR: fix range check in mtrr_add_page() Jan Beulich
2013-08-13 16:55 ` Andrew Cooper
2013-08-13 17:34 ` Keir Fraser
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.