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

[Xen-changelog] [xen staging] xen/arm: make_memory_node return error on nr_banks == 0



commit a89a41bc33d4fe16609090179aa7d92fbba90138
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Mon Oct 7 18:15:00 2019 -0700
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Tue Oct 8 14:10:09 2019 -0700

    xen/arm: make_memory_node return error on nr_banks == 0
    
    Call make_memory_node for reserved_memory only if we actually have any
    reserved_memory regions to handle.
    
    Add a check in make_memory_node to return an error if it has been called
    with no memory banks as argument.
    
    Fixes: 248faa637d2 (xen/arm: add reserved-memory regions to the dom0 memory 
node)
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>
    Acked-by: Julien Grall <julien.grall@xxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/arch/arm/domain_build.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 921b054520..5ab84e5839 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -650,6 +650,8 @@ static int __init make_memory_node(const struct domain *d,
     __be32 *cells;
 
     BUG_ON(nr_cells >= ARRAY_SIZE(reg));
+    if ( mem->nr_banks == 0 )
+        return -ENOENT;
 
     dt_dprintk("Create memory node (reg size %d, nr cells %d)\n",
                reg_size, nr_cells);
@@ -1540,10 +1542,13 @@ static int __init handle_node(struct domain *d, struct 
kernel_info *kinfo,
          * Create a second memory node to store the ranges covering
          * reserved-memory regions.
          */
-        res = make_memory_node(d, kinfo->fdt, addrcells, sizecells,
-                               &bootinfo.reserved_mem);
-        if ( res )
-            return res;
+        if ( bootinfo.reserved_mem.nr_banks > 0 )
+        {
+            res = make_memory_node(d, kinfo->fdt, addrcells, sizecells,
+                                   &bootinfo.reserved_mem);
+            if ( res )
+                return res;
+        }
     }
 
     res = fdt_end_node(kinfo->fdt);
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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