[PATCH] spl: spl_legacy: Fix spl_end address

Fabio Estevam festevam at gmail.com
Fri Jun 30 20:26:27 CEST 2023


On Fri, Jun 30, 2023 at 11:23 AM Fabio Estevam <festevam at gmail.com> wrote:

> diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
> index d34bc5492e8d..095443c63d8d 100644
> --- a/common/spl/spl_legacy.c
> +++ b/common/spl/spl_legacy.c
> @@ -19,7 +19,7 @@
>  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)__bss_end;
> +       uintptr_t spl_end = (uintptr_t)_image_binary_end;
>         uintptr_t end = start + size;

I have been thinking more about this and it seems we need to take
CONFIG_SPL_SEPARATE_BSS
into account.

Should we do this instead?

--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -19,9 +19,14 @@
 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)__bss_end;
+       uintptr_t spl_end;
        uintptr_t end = start + size;

+       if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
+               spl_end = (uintptr_t)_image_binary_end;
+       else
+               spl_end = (uintptr_t)__bss_end;
+
        if ((start >= spl_start && start < spl_end) ||
            (end > spl_start && end <= spl_end) ||
            (start < spl_start && end >= spl_end) ||


More information about the U-Boot mailing list