[PATCH v2 1/2] lib/fdtdec.c: Disallow overriding BLOBLIST_PASSAGE_MANDATORY

Tom Rini <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
When we have CONFIG_BLOBLIST_PASSAGE_MANDATORY enabled, we don't allow
the device tree address to be overridden. However, in fdtdec_setup() we
had been allowing for various cases of not having found the device tree
in the bloblist, or overriding it, to be possible. Add a check after the
bloblist check such that if we have enabled BLOBLIST_PASSAGE_MANDATORY
we return an error at that point.

Signed-off-by: Tom Rini <[email protected]>
---
Changes in v2:
- Based on Raymond's feedback to v1, look harder at this code again and
  introduce a single check earlier on to cause fdtdec_setup to bail out
  in the case of BLOBLIST_PASSAGE_MANDATORY and not found.

Cc: Ilias Apalodimas <[email protected]>
Cc: Raymond Mao <[email protected]>
---
 lib/fdtdec.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index b91e067106dd..d25535bf36cf 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1845,6 +1845,13 @@ int fdtdec_setup(void)
 		}
 	}
 
+	/*
+	 * If we have bloblist being required to pass the FDT and we reach this
+	 * point, we have a problem and must exit.
+	 */
+	if (IS_ENABLED(CONFIG_BLOBLIST_PASSAGE_MANDATORY))
+		return ret;
+
 	/* Otherwise, the devicetree is typically appended to U-Boot */
 	if (ret) {
 		if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.