From: Bryan O'Donoghue Date: Tue, 9 Jul 2019 00:10:56 +0100 Subject: [U-Boot] [PATCH 1/2] efi_loader: Check the result of efi_add_memory_map against input addr In-Reply-To: <20190708231057.29282-1-pure.logic@nexus-software.ie> References: <20190708231057.29282-1-pure.logic@nexus-software.ie> Message-ID: <20190708231057.29282-2-pure.logic@nexus-software.ie> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de We should check the result of efi_add_memory_map() against the first input parameter, not against zero. In efi_carve_out_dt_rsv() add_efi_memory_map() gets passed addr = 0. The function succeeds but the parsing routine interprets zero as an error. Fix that now by comparing the result code of add_efi_memory_map() to the first input parameter as other users of add_efi_memory_map() already do. Removes this error on raspberrypi 3 boot: "FDT memrsv map 0: Failed to add to map". Fixes: 416e07e2cfcf ("efi: Drop error return in efi_carve_out_dt_rsv()") Cc: Heinrich Schuchardt Cc: Alexander Graf Signed-off-by: Bryan O'Donoghue --- cmd/bootefi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index c19256e00d..0b404ccbd1 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -169,8 +169,8 @@ static void efi_carve_out_dt_rsv(void *fdt) pages = efi_size_in_pages(size + (addr & EFI_PAGE_MASK)); addr &= ~EFI_PAGE_MASK; - if (!efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE, - false)) + if (efi_add_memory_map(addr, pages, EFI_RESERVED_MEMORY_TYPE, + false) != addr) printf("FDT memrsv map %d: Failed to add to map\n", i); } } -- 2.22.0