[Xen-devel,for-4.13] xen/arm: setup: Calculate correctly the size of Xen

Message ID 20191016111251.29214-1-julien.grall@arm.com
State New
Headers show
Series
  • [Xen-devel,for-4.13] xen/arm: setup: Calculate correctly the size of Xen
Related show

Commit Message

Julien Grall Oct. 16, 2019, 11:12 a.m.
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.

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jürgen Groß Oct. 16, 2019, 11:14 a.m. | #1
On 16.10.19 13:12, Julien Grall wrote:
> 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.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen
Stefano Stabellini Oct. 16, 2019, 4:23 p.m. | #2
On Wed, 16 Oct 2019, Julien Grall wrote:
> 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.
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/setup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
> index 705a917abf..51d32106b7 100644
> --- a/xen/arch/arm/setup.c
> +++ b/xen/arch/arm/setup.c
> @@ -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);
> -- 
> 2.11.0
>

Patch

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 705a917abf..51d32106b7 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -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);