[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] xen/arm: fix math in add_ext_regions



commit 9b21841fd1da2472605a4fe7120fb318a8d88faf
Author:     Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
AuthorDate: Thu May 8 09:20:30 2025 -0400
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Thu May 8 16:36:49 2025 -0700

    xen/arm: fix math in add_ext_regions
    
    In commit f37a59813979, the arguments to add_ext_regions() were switched
    from addresses to frame numbers. add_ext_regions() converts the frame
    numbers back to addresses, but the end address (e) is rounded down to
    page size alignment. The logic to calculate the size assumes e points to
    the last address, not page, effectively leading to the region size being
    erroneously calculated to be 2M smaller than the actual size of the
    region.
    
    Fix by adding 1 to the frame number before converting back to address.
    
    Fixes: f37a59813979 ("xen/arm: domain_build: Track unallocated pages using 
the frame number")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
    Acked-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/domain_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index df29619c40..2f2b021dec 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -761,7 +761,7 @@ int __init add_ext_regions(unsigned long s_gfn, unsigned 
long e_gfn,
     struct membanks *ext_regions = data;
     paddr_t start, size;
     paddr_t s = pfn_to_paddr(s_gfn);
-    paddr_t e = pfn_to_paddr(e_gfn);
+    paddr_t e = pfn_to_paddr(e_gfn + 1) - 1;
 
     if ( ext_regions->nr_banks >= ext_regions->max_banks )
         return 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.