Skip to contentSkip to conversation

bootm: fix wrong conditions about images overlap

PATCH New Jaehoon Chung 2 participants 2 messages Oct 21, 2020 – Oct 24, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20201021051652epcas1p4cc4c14b796a2ee1233ccfcaeb765a8b6@epcas1p4.samsung.com

#1 lore raw

PATCH 1/1 bootm: fix wrong conditions about images overlap

It doesn't need to consider start byte address.
If ramdisk size is 0x800000 and start address is 0x2700000, then it's used until 0x02efffff, not 0x02f00000. But it's detected to overlapt RD image, when kernel start address is 0x02f00000.
Because it's doing wrong calculation about rd_len.
This patch fixed wrong calculation address position when check condition.

In addition, it needs to check one more condition about overlapping entire area.

Fixes commit fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image")
---
 common/bootm.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
common/bootm.c +5 -3
index b3377490b3ef..167eea4a1e9f 100644
@@ -256,9 +256,11 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
 
 	/* check if ramdisk overlaps OS image */
 	if (images.rd_start && (((ulong)images.rd_start >= start &&
-				 (ulong)images.rd_start <= start + size) ||
-				((ulong)images.rd_end >= start &&
-				 (ulong)images.rd_end <= start + size))) {
+				 (ulong)images.rd_start < start + size) ||
+				((ulong)images.rd_end > start &&
+				 (ulong)images.rd_end <= start + size) ||
+				((ulong)images.rd_start < start &&
+				 (ulong)images.rd_end >= start + size))) {
 		printf("ERROR: RD image overlaps OS image (OS=0x%lx..0x%lx)\n",
 		       start, start + size);
 		return 1;
Signature · 1 line
2.28.0
#2 lore raw

PATCH 1/1 bootm: fix wrong conditions about images overlap

Quoted 8 lines · Jaehoon Chung

It doesn't need to consider start byte address.
If ramdisk size is 0x800000 and start address is 0x2700000, then it's used until 0x02efffff, not 0x02f00000. But it's detected to overlapt RD image, when kernel start address is 0x02f00000.
Because it's doing wrong calculation about rd_len.
This patch fixed wrong calculation address position when check condition.

Quoted 6 lines

In addition, it needs to check one more condition about overlapping entire area.

Fixes commit fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image")

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/20201024/cfbca416/attachment.sig>