aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-07-05 11:28:55 -0400
committerTom Rini <trini@konsulko.com>2023-07-05 11:28:55 -0400
commite80f4079b3a3db0961b73fa7a96e6c90242d8d25 (patch)
tree5352d65d18b44e0982152654dc9f8018047e65ae /common
parent45f77b807c2f6b8da88ae897b7eb2238e25df36b (diff)
parente1bebc16e1d9aa0ddd56c53c0b781f7186dce557 (diff)
downloadu-boot-e80f4079b3a3db0961b73fa7a96e6c90242d8d25.zip
u-boot-e80f4079b3a3db0961b73fa7a96e6c90242d8d25.tar.gz
u-boot-e80f4079b3a3db0961b73fa7a96e6c90242d8d25.tar.bz2
Merge tag 'v2023.07-rc6' into next
Prepare v2023.07-rc6
Diffstat (limited to 'common')
-rw-r--r--common/menu.c2
-rw-r--r--common/spl/spl_ext.c4
-rw-r--r--common/spl/spl_fit.c7
-rw-r--r--common/spl/spl_legacy.c20
4 files changed, 23 insertions, 10 deletions
diff --git a/common/menu.c b/common/menu.c
index 9451417..b55cf7b 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -15,7 +15,7 @@
#include "menu.h"
-#define ansi 0
+#define ansi 1
/*
* Internally, each item in a menu is represented by a struct menu_item.
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index f117c63..2bf3434 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -28,7 +28,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
ext4fs_set_blk_dev(block_dev, &part_info);
- err = ext4fs_mount(0);
+ err = ext4fs_mount(part_info.size);
if (!err) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("%s: ext4fs mount err - %d\n", __func__, err);
@@ -82,7 +82,7 @@ int spl_load_image_ext_os(struct spl_image_info *spl_image,
ext4fs_set_blk_dev(block_dev, &part_info);
- err = ext4fs_mount(0);
+ err = ext4fs_mount(part_info.size);
if (!err) {
#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
printf("%s: ext4fs mount err - %d\n", __func__, err);
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index c51482b..730639f 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -27,10 +27,6 @@ struct spl_fit_info {
int conf_node; /* FDT offset to selected configuration node */
};
-__weak void board_spl_fit_post_load(const void *fit)
-{
-}
-
__weak ulong board_spl_fit_size_align(ulong size)
{
return size;
@@ -829,8 +825,5 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
spl_image->flags |= SPL_FIT_FOUND;
- if (IS_ENABLED(CONFIG_IMX_HAB))
- board_spl_fit_post_load(ctx.fit);
-
return 0;
}
diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index 16851c5..095443c 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -7,6 +7,7 @@
#include <image.h>
#include <log.h>
#include <malloc.h>
+#include <asm/sections.h>
#include <spl.h>
#include <lzma/LzmaTypes.h>
@@ -15,6 +16,22 @@
#define LZMA_LEN (1 << 20)
+static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size)
+{
+ uintptr_t spl_start = (uintptr_t)_start;
+ 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))
+ panic("SPL: Image overlaps SPL\n");
+
+ if (size > CONFIG_SYS_BOOTM_LEN)
+ panic("SPL: Image too large\n");
+}
+
int spl_parse_legacy_header(struct spl_image_info *spl_image,
const struct legacy_img_hdr *header)
{
@@ -58,6 +75,9 @@ int spl_parse_legacy_header(struct spl_image_info *spl_image,
"payload image: %32s load addr: 0x%lx size: %d\n",
spl_image->name, spl_image->load_addr, spl_image->size);
+ spl_parse_legacy_validate(spl_image->load_addr, spl_image->size);
+ spl_parse_legacy_validate(spl_image->entry_point, 0);
+
return 0;
}