diff mbox series

[1/1] efi_loader: only reserve memory if fdt node enabled

Message ID 20200324065527.8192-1-xypron.glpk@gmx.de
State Superseded
Headers show
Series [1/1] efi_loader: only reserve memory if fdt node enabled | expand

Commit Message

Heinrich Schuchardt March 24, 2020, 6:55 a.m. UTC
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 at st.com>
Fixes: fef907b2e440 ("efi_loader: create reservations after
ft_board_setup")
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 cmd/bootefi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.25.1

Comments

Atish Patra March 24, 2020, 6:14 p.m. UTC | #1
On Mon, Mar 23, 2020 at 11:55 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> 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 at st.com>
> Fixes: fef907b2e440 ("efi_loader: create reservations after
> ft_board_setup")
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  cmd/bootefi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 3bbe2d6a1a..aaed575505 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -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);
>                 }
> --
> 2.25.1
>


Reviewed-by: Atish Patra <atish.patra at wdc.com>
diff mbox series

Patch

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 3bbe2d6a1a..aaed575505 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -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);
 		}