[PATCHv3 4/6] efi_selftest_memory: check for duplicates first

Ilias Apalodimas ilias.apalodimas at linaro.org
Thu Apr 16 10:55:18 CEST 2026


On Mon, 13 Apr 2026 at 23:36, <rs at ti.com> wrote:
>
> From: Randolph Sapp <rs at ti.com>
>
> Check for duplicate memory mappings before reporting any incorrect
> attributes. Could be that second allocation has the correct type while
> the first doesn't. Knowing there is a duplicate in this scenario is
> more helpful than just reporting the first mismatch.
>
> Signed-off-by: Randolph Sapp <rs at ti.com>

[...]

>                         }
> -                       found = true;
> -                       if (memory_type != entry->type) {
> -                               efi_st_error
> -                                       ("Wrong memory type %d, expected %d\n",
> -                                        entry->type, memory_type);
> -                               return EFI_ST_FAILURE;
> -                       }
> +                       match = entry;
>                 }
>         }
> -       if (!found) {
> +       if (!match) {
>                 efi_st_error("Missing memory map entry\n");
>                 return EFI_ST_FAILURE;
>         }
> +       if (memory_type != match->type) {
> +               efi_st_error("Wrong memory type %d, expected %d\n", match->type,
> +                            memory_type);
> +               return EFI_ST_FAILURE;

This check is now outside the loop and only checks for the last entry.
If you wan't to split the fucntionality, don't we need a loop over all
memory areas and the type?

Thanks
/Ilias


> +       }
>         return EFI_ST_SUCCESS;
>  }
>
> --
> 2.53.0
>


More information about the U-Boot mailing list