efi_loader: only reserve memory if fdt node enabled
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 24 Mar 2020 06:37:52 +0000 (07:37 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 28 Mar 2020 09:45:03 +0000 (10:45 +0100)
Sub-nodes of /reserved-memory may be disabled. In this case we should not
reserve memory in the memory map.

Reported-by: Patrick DELAUNAY <patrick.delaunay@st.com>
Fixes: fef907b2e440 ("efi_loader: create reservations after
ft_board_setup")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
cmd/bootefi.c

index 3bbe2d6a1a40ca344e4ca5c7ccc8f68ecda612fe..aaed575505968b8f65b4ae89adf9e39b2e251b8e 100644 (file)
@@ -199,7 +199,8 @@ static void efi_carve_out_dt_rsv(void *fdt)
                         * The /reserved-memory node may have children with
                         * a size instead of a reg property.
                         */
-                       if (addr != FDT_ADDR_T_NONE)
+                       if (addr != FDT_ADDR_T_NONE &&
+                           fdtdec_get_is_enabled(fdt, subnode))
                                efi_reserve_memory(addr, size);
                        subnode = fdt_next_subnode(fdt, subnode);
                }