]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd: efi: Fix wrong memory descriptor end address
authorBin Meng <bmeng.cn@gmail.com>
Fri, 22 Jun 2018 08:38:31 +0000 (01:38 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Sun, 24 Jun 2018 00:56:33 +0000 (08:56 +0800)
Each entry of the EFI memory descriptors occupies map->desc_size,
not sizeof(struct efi_mem_desc).

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/efi.c

index 2511c6cb78a0f188572071ced1b323832ccec5d9..6c1eb88424be054c56d26b90da72f3e637acc2c0 100644 (file)
--- a/cmd/efi.c
+++ b/cmd/efi.c
@@ -83,7 +83,7 @@ void *efi_build_mem_table(struct efi_entry_memmap *map, int size, bool skip_bs)
        prev = NULL;
        addr = 0;
        dest = base;
-       end = base + count;
+       end = (struct efi_mem_desc *)((ulong)base + count * map->desc_size);
        for (desc = base; desc < end; desc = efi_get_next_mem_desc(map, desc)) {
                bool merge = true;
                int type = desc->type;