]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
libfdt: Detected out-of-space with fdt_finish()
authorSimon Glass <sjg@chromium.org>
Tue, 1 Sep 2020 11:13:56 +0000 (05:13 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 22 Sep 2020 18:50:43 +0000 (12:50 -0600)
At present the Python sequential-write interface can produce an error when
it calls fdt_finish(), since this needs to add a terminating tag to the
end of the struct section.

Fix this by automatically expanding the buffer if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
scripts/dtc/pylibfdt/libfdt.i_shipped

index fae0b27d7d0908789c02aefb90edafebdbf551b5..1d69ad38e2e35a3f31826c275621f930e0a17f44 100644 (file)
@@ -786,7 +786,8 @@ class FdtSw(FdtRo):
             Fdt object allowing access to the newly created device tree
         """
         fdtsw = bytearray(self._fdt)
-        check_err(fdt_finish(fdtsw))
+        while self.check_space(fdt_finish(fdtsw)):
+            fdtsw = bytearray(self._fdt)
         return Fdt(fdtsw)
 
     def check_space(self, val):