diff mbox series

[U-Boot,v2,12/31] binman: Call ProcessUpdateContents() consistently

Message ID 20190708202553.225715-13-sjg@chromium.org
State Accepted
Commit 7f9e00a2a6a3aff06572fdf225e51556f85853f4
Delegated to: Simon Glass
Headers show
Series binman: Allow reading of images to list contents | expand

Commit Message

Simon Glass July 8, 2019, 8:25 p.m. UTC
SetContents() should only be called to set the contents of an entry from
within the ObtainContents() call, since it has no guard against increasing
the size of the contents, thus triggering incorrect operation.

Change all such calls to use ProcessUpdateContents() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/etype/blob_dtb.py     | 2 +-
 tools/binman/etype/fdtmap.py       | 2 +-
 tools/binman/etype/fmap.py         | 2 +-
 tools/binman/etype/image_header.py | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Comments

Simon Glass July 18, 2019, 1:58 a.m. UTC | #1
SetContents() should only be called to set the contents of an entry from
within the ObtainContents() call, since it has no guard against increasing
the size of the contents, thus triggering incorrect operation.

Change all such calls to use ProcessUpdateContents() instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 tools/binman/etype/blob_dtb.py     | 2 +-
 tools/binman/etype/fdtmap.py       | 2 +-
 tools/binman/etype/fmap.py         | 2 +-
 tools/binman/etype/image_header.py | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
index cc5b4a3f760..d80c3d7e006 100644
--- a/tools/binman/etype/blob_dtb.py
+++ b/tools/binman/etype/blob_dtb.py
@@ -30,4 +30,4 @@  class Entry_blob_dtb(Entry_blob):
     def ProcessContents(self):
         """Re-read the DTB contents so that we get any calculated properties"""
         _, data = state.GetFdtContents(self._filename)
-        self.SetContents(data)
+        self.ProcessContentsUpdate(data)
diff --git a/tools/binman/etype/fdtmap.py b/tools/binman/etype/fdtmap.py
index cdeb491ebdc..ddac148b9ba 100644
--- a/tools/binman/etype/fdtmap.py
+++ b/tools/binman/etype/fdtmap.py
@@ -106,4 +106,4 @@  class Entry_fdtmap(Entry):
         This is necessary since new data may have been written back to it during
         processing, e.g. the image-pos properties.
         """
-        self.SetContents(self._GetFdtmap())
+        self.ProcessContentsUpdate(self._GetFdtmap())
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index e6b5c5c74c0..45d6db18a31 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -62,4 +62,4 @@  class Entry_fmap(Entry):
         return True
 
     def ProcessContents(self):
-        self.SetContents(self._GetFmap())
+        self.ProcessContentsUpdate(self._GetFmap())
diff --git a/tools/binman/etype/image_header.py b/tools/binman/etype/image_header.py
index 9bc84ec01d4..d6de58ce4b7 100644
--- a/tools/binman/etype/image_header.py
+++ b/tools/binman/etype/image_header.py
@@ -73,4 +73,4 @@  class Entry_image_header(Entry):
         This is necessary since image_pos is not available when ObtainContents()
         is called, since by then the entries have not been packed in the image.
         """
-        self.SetContents(self._GetHeader())
+        self.ProcessContentsUpdate(self._GetHeader())