Date: Thu, 23 Aug 2018 01:22:14 +0000 (UTC) From: Kyle Evans <kevans@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338219 - head/stand/fdt Message-ID: <201808230122.w7N1MEcH047437@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kevans Date: Thu Aug 23 01:22:13 2018 New Revision: 338219 URL: https://svnweb.freebsd.org/changeset/base/338219 Log: fdt_fixups: relocate the /chosen node after applying fixups As indicated by the comment, any fixups applied (which might include overlays) can invalidate the previously located node by adding nodes or setting/adding properties. The later fdt_setprop of fixup-applied property would then fail because of the bad/wrong node offset. This would have generally been harmless, but potentially caused multiple applications of fixups and caused a little bit of bloat. MFC after: 1 week Modified: head/stand/fdt/fdt_loader_cmd.c Modified: head/stand/fdt/fdt_loader_cmd.c ============================================================================== --- head/stand/fdt/fdt_loader_cmd.c Thu Aug 23 00:58:10 2018 (r338218) +++ head/stand/fdt/fdt_loader_cmd.c Thu Aug 23 01:22:13 2018 (r338219) @@ -933,6 +933,12 @@ fdt_fixup(void) fdt_platform_fixups(); + /* + * Re-fetch the /chosen subnode; our fixups may apply overlays or add + * nodes/properties that invalidate the offset we grabbed or created + * above, so we can no longer trust it. + */ + chosen = fdt_subnode_offset(fdtp, 0, "chosen"); fdt_setprop(fdtp, chosen, "fixup-applied", NULL, 0); return (1); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808230122.w7N1MEcH047437>