[PATCH 1/1] spl: spl_legacy: simplify spl_parse_legacy_validate

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sat Jul 22 20:46:07 CEST 2023


The check for an overlap of the loaded image and SPL is overly
complicated.

Fixes: 77aed22b48ab ("spl: spl_legacy: Add extra address checks")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 common/spl/spl_legacy.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index 095443c63d..9246f555e3 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -22,10 +22,7 @@ static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size)
 	uintptr_t spl_end = (uintptr_t)_image_binary_end;
 	uintptr_t end = start + size;
 
-	if ((start >= spl_start && start < spl_end) ||
-	    (end > spl_start && end <= spl_end) ||
-	    (start < spl_start && end >= spl_end) ||
-	    (start > end && end > spl_start))
+	if (end > spl_start && start < spl_end)
 		panic("SPL: Image overlaps SPL\n");
 
 	if (size > CONFIG_SYS_BOOTM_LEN)
-- 
2.40.1



More information about the U-Boot mailing list