Skip to contentSkip to conversation

bootm: Fix upper bound of FDT overlap checks

PATCH In review Pali Rohár 3 participants 3 messages Aug 27, 2022 – Aug 31, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootm: Fix upper bound of FDT overlap checks

FTD blob can be put immediately after the OS image. So use strict inequality for start address check.

Fixes fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image")
---
 boot/bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
boot/bootm.c +2 -2
index 86dbfbcfed5b..e4493f3ed5f1 100644
@@ -305,9 +305,9 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
 	/* check if FDT overlaps OS image */
 	if (images.ft_addr &&
 	    (((ulong)images.ft_addr >= start &&
-	      (ulong)images.ft_addr <= start + size) ||
+	      (ulong)images.ft_addr < start + size) ||
 	     ((ulong)images.ft_addr + images.ft_len >= start &&
-	      (ulong)images.ft_addr + images.ft_len <= start + size))) {
+	      (ulong)images.ft_addr + images.ft_len < start + size))) {
 		printf("ERROR: FDT image overlaps OS image (OS=0x%lx..0x%lx)\n",
 		       start, start + size);
 		return 1;
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Pali Rohár

FTD blob can be put immediately after the OS image. So use strict inequality for start address check.

Fixes fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image")
---
 boot/bootm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)