]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/MCFG: fix off-by-one in E820 check
authorJan Beulich <jbeulich@suse.com>
Tue, 18 Feb 2020 15:24:24 +0000 (16:24 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 18 Feb 2020 15:24:24 +0000 (16:24 +0100)
Also adjust the comment ahead of e820_all_mapped() to clarify that the
range is not inclusive at its end.

Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wl@xen.org>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/e820.c
xen/arch/x86/x86_64/mmconfig-shared.c

index c9dc52c7683b3cf366daea940d4babd426a35885..aa602773bbfd6189fc7bdc11a8b6a8e9a5cf7754 100644 (file)
@@ -38,7 +38,7 @@ struct e820map e820;
 struct e820map __initdata e820_raw;
 
 /*
- * This function checks if the entire range <start,end> is mapped with type.
+ * This function checks if the entire range [start,end) is mapped with type.
  *
  * Note: this function only works correct if the e820 table is sorted and
  * not-overlapping, which is the case
@@ -56,7 +56,8 @@ int __init e820_all_mapped(u64 start, u64 end, unsigned type)
                if (ei->addr >= end || ei->addr + ei->size <= start)
                        continue;
 
-               /* if the region is at the beginning of <start,end> we move
+               /*
+                * If the region is at the beginning of [start,end) we move
                 * start to the end of the region since it's ok until there
                 */
                if (ei->addr <= start)
index 0c55c7206e9b3d703855d241b98c2182098c7d36..7c3ed64b4c6ce9752737101350f79128b602c471 100644 (file)
@@ -337,7 +337,7 @@ static int __init is_mmconf_reserved(
     u64 old_size = size;
     int valid = 0;
 
-    while (!e820_all_mapped(addr, addr + size - 1, E820_RESERVED)) {
+    while (!e820_all_mapped(addr, addr + size, E820_RESERVED)) {
         size >>= 1;
         if (size < (16UL<<20))
             break;