diff options
author | Jaehoon Chung <jh80.chung@samsung.com> | 2020-10-21 08:17:03 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-10-23 20:33:07 +0300 |
commit | ef4f4f1f5f4ed70d65cb7e79f37c3f597f34a9d4 (patch) | |
tree | a800559bb4f09991378cf23d49743211d8301424 /common | |
parent | 274227500abc9592f92f5255f6db65e927bc2edd (diff) | |
download | u-boot-ef4f4f1f5f4ed70d65cb7e79f37c3f597f34a9d4.tar.xz |
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")
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/bootm.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/bootm.c b/common/bootm.c index b3377490b3..167eea4a1e 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -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; |