From 1bef7c29bbb4679935a5350f2c347aac2adc6b73 Mon Sep 17 00:00:00 2001 From: kevans Date: Thu, 1 Feb 2018 14:31:12 +0000 Subject: [PATCH] D14130: stand/fdt: Rip out FDT VA tracking Whether we should be overwriting the loaded FDT module with the 'fixed up' version or not was questionable when this was added, and now that overlays are possible this is downright wrong. Overlays can increase the size of the blob, so writing it back to the original VA will generally write past the end of the block and start clobbering other things in memory. Rip it out- it was questionable to begin with, it's doing bad things now, and it serves no purpose since the modified blob will be copied into place rather than relying on this to reflect the changes. Reviewed by: gonzo MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14130 --- stand/fdt/fdt_loader_cmd.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/stand/fdt/fdt_loader_cmd.c b/stand/fdt/fdt_loader_cmd.c index 764d523614e..bfc424cc6ac 100644 --- a/stand/fdt/fdt_loader_cmd.c +++ b/stand/fdt/fdt_loader_cmd.c @@ -67,10 +67,6 @@ static struct fdt_header *fdt_to_load = NULL; static struct fdt_header *fdtp = NULL; /* Size of FDT blob */ static size_t fdtp_size = 0; -/* Location of FDT in kernel or module. */ -/* This won't be set if FDT is loaded from disk or memory. */ -/* If it is set, we'll update it when fdt_copy() gets called. */ -static vm_offset_t fdtp_va = 0; static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); @@ -221,7 +217,6 @@ fdt_load_dtb(vm_offset_t va) return (1); } - fdtp_va = va; COPYOUT(va, fdtp, fdtp_size); debugf("DTB blob found at 0x%jx, size: 0x%jx\n", (uintmax_t)va, (uintmax_t)fdtp_size); @@ -248,7 +243,6 @@ fdt_load_dtb_addr(struct fdt_header *header) return (1); } - fdtp_va = 0; // Don't write this back into module or kernel. bcopy(header, fdtp, fdtp_size); return (0); } @@ -962,11 +956,6 @@ fdt_copy(vm_offset_t va) if (fdt_fixup() == 0) return (0); - if (fdtp_va != 0) { - /* Overwrite the FDT with the fixed version. */ - /* XXX Is this really appropriate? */ - COPYIN(fdtp, fdtp_va, fdtp_size); - } COPYIN(fdtp, va, fdtp_size); return (fdtp_size); } -- 2.45.0