boot_get_kernel() maps a bare 64 bytes to identify the image format.
genimg_get_format() reads at most a 40-byte FDT header or an 8-byte
Android magic, but the legacy branch that follows verifies the whole
64-byte legacy header, so that is the size the mapping has to cover.

Say so with sizeof(struct legacy_img_hdr).

Signed-off-by: Daniel Golle <[email protected]>
---
 boot/bootm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/boot/bootm.c b/boot/bootm.c
index 92c8452a5d3..b9aa83c3328 100644
--- a/boot/bootm.c
+++ b/boot/bootm.c
@@ -158,7 +158,8 @@ static int boot_get_kernel(const char *addr_fit, struct 
bootm_headers *images,
                 * parsed any #config / :subimage suffix so the FIT
                 * selection variables are populated.
                 */
-               buf = imagemap_map(images->imagemap, 0, 64);
+               buf = imagemap_map(images->imagemap, 0,
+                                  sizeof(struct legacy_img_hdr));
                if (IS_ERR(buf)) {
                        puts("Cannot read image header from storage\n");
                        return PTR_ERR(buf);
-- 
2.56.0

Reply via email to