Skip to contentSkip to conversation

xen/arm: setup: Calculate correctly the size of Xen

PATCH In review Julien Grall 3 participants 3 messages Oct 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: setup: Calculate correctly the size of Xen

The current size of Xen is computed using _end - _start + 1. However, _end is pointing one past the end of Xen, so the size of Xen is off-by-one.

---
 xen/arch/arm/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/setup.c +1 -1
index 705a917abf..51d32106b7 100644
@@ -819,7 +819,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     /* Register Xen's load address as a boot module. */
     xen_bootmodule = add_boot_module(BOOTMOD_XEN,
                              (paddr_t)(uintptr_t)(_start + boot_phys_offset),
-                             (paddr_t)(uintptr_t)(_end - _start + 1), false);
+                             (paddr_t)(uintptr_t)(_end - _start), false);
     BUG_ON(!xen_bootmodule);
 
     fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr);
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#2 lore raw
In reply to Julien Grall
Quoted 5 lines · Julien Grall

The current size of Xen is computed using _end - _start + 1. However, _end is pointing one past the end of Xen, so the size of Xen is off-by-one.

Quoted 20 lines
---
 xen/arch/arm/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/setup.c +1 -1
index 705a917abf..51d32106b7 100644
@@ -819,7 +819,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     /* Register Xen's load address as a boot module. */
     xen_bootmodule = add_boot_module(BOOTMOD_XEN,
                              (paddr_t)(uintptr_t)(_start + boot_phys_offset),
-                             (paddr_t)(uintptr_t)(_end - _start + 1), false);
+                             (paddr_t)(uintptr_t)(_end - _start), false);
     BUG_ON(!xen_bootmodule);
 
     fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr);
Signature · 1 line
2.11.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel