Skip to contentSkip to conversation

bootm: update image OS image size when decompressing

PATCH New Heinrich Schuchardt 3 participants 3 messages Aug 30, 2020 – Sep 14, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootm: update image OS image size when decompressing

In bootm_load_os() the OS image is decompressed. In later stages of the boot process we need the decompressed size of the image.

Update images->os.image_len after decompression.

Passing the correct size is necessary if we want to check loaded EFI binararies for file truncation by comparing the loaded size to the header field SizeOfImage.

---
 common/bootm.c | 2 ++
 1 file changed, 2 insertions(+)
common/bootm.c +2 -0
index 247b600d9c..b3377490b3 100644
@@ -390,6 +390,8 @@ static int bootm_load_os(bootm_headers_t *images, int boot_progress)
 		bootstage_error(BOOTSTAGE_ID_DECOMP_IMAGE);
 		return err;
 	}
+	/* We need the decompressed image size in the next steps */
+	images->os.image_len = load_end - load;
 
 	flush_cache(flush_start, ALIGN(load_end, ARCH_DMA_MINALIGN) - flush_start);
 

--
2.28.0

#1 lore raw

PATCH 1/1 bootm: update image OS image size when decompressing

Quoted 6 lines · Heinrich Schuchardt

In bootm_load_os() the OS image is decompressed. In later stages of the boot process we need the decompressed size of the image.

Update images->os.image_len after decompression.

Quoted 9 lines

Passing the correct size is necessary if we want to check loaded EFI binararies for file truncation by comparing the loaded size to the header field SizeOfImage.

---
 common/bootm.c | 2 ++
 1 file changed, 2 insertions(+)
#2 lore raw

PATCH 1/1 bootm: update image OS image size when decompressing

In reply to Heinrich Schuchardt
Quoted 11 lines · Heinrich Schuchardt

In bootm_load_os() the OS image is decompressed. In later stages of the boot process we need the decompressed size of the image.

Update images->os.image_len after decompression.

Passing the correct size is necessary if we want to check loaded EFI binararies for file truncation by comparing the loaded size to the header field SizeOfImage.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200914/251c64af/attachment.sig>