From e95484295c0c3589b45ffebba2463be2b306c69a Mon Sep 17 00:00:00 2001 From: kettenis Date: Wed, 16 Mar 2022 22:32:50 +0000 Subject: [PATCH] When we allocate space a buffer with some extra space for the FDT, adjust the size of the FDT to reflect the size of that buffer. This prevents an FDT overflow if the original FDT doesn't have enough space for the additional properties that we add to it in our bootloader. Fixes boot on the mcbin. tested by bluhm@, ok patrick@ --- sys/arch/arm64/stand/efiboot/efiboot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/arch/arm64/stand/efiboot/efiboot.c b/sys/arch/arm64/stand/efiboot/efiboot.c index f21b69de8c0..a38021f5a82 100644 --- a/sys/arch/arm64/stand/efiboot/efiboot.c +++ b/sys/arch/arm64/stand/efiboot/efiboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efiboot.c,v 1.38 2021/12/15 00:37:21 deraadt Exp $ */ +/* $OpenBSD: efiboot.c,v 1.39 2022/03/16 22:32:50 kettenis Exp $ */ /* * Copyright (c) 2015 YASUOKA Masahiko @@ -554,6 +554,7 @@ efi_makebootargs(char *bootargs, int howto) if (BS->AllocatePages(AllocateAnyPages, EfiLoaderData, EFI_SIZE_TO_PAGES(len), &addr) == EFI_SUCCESS) { memcpy((void *)addr, fdt, fdt_get_size(fdt)); + ((struct fdt_head *)addr)->fh_size = len; fdt = (void *)addr; } -- 2.20.1