diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-03-16 22:32:51 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2022-03-16 22:32:51 +0000 |
commit | 52d3d386b852f0aaaf2e306092b8cbf38150cec0 (patch) | |
tree | 0e4dc1c3715f98eccd6b33f0fd608c51e010896f /sys/arch/arm64/stand | |
parent | 229e9428f0ea7ac06a3778e21f2a357557f8c9fa (diff) |
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@
Diffstat (limited to 'sys/arch/arm64/stand')
-rw-r--r-- | sys/arch/arm64/stand/efiboot/efiboot.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 <yasuoka@yasuoka.net> @@ -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; } |