Re: [PATCH 2/6] disk: part_efi: Add missing endianness conversions

Simon Glass <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <CAFLszTjn+pNik+Vc5WKeTBpz4vAZ39pFRfnGOYtLEjdA9vpjLg@mail.gmail.com>
On 2026-07-31T12:39:59, Alexey Charkov <[email protected]> wrote:
> disk: part_efi: Add missing endianness conversions
>
> Several GPT header fields are read without converting from
> little-endian, which is wrong on big-endian hosts.
>
> gpt_fill_pte() takes my_lba and partition_entry_lba raw when working out
> the region a partition must not overlap, so on a big-endian host both
> bounds are byte-swapped garbage and the overlap check does not do
> anything useful.
>
> gpt_verify_partitions() compares the loop counter against
> num_partition_entries raw, so its "More partitions than allowed!" guard
> never triggers.
>
> It also swaps gpt_part_size, which is already in host order, having been
> computed from two le64_to_cpu() results a few lines above. Drop the
> conversion rather than adding one.
>
> All of this is a no-op on little-endian targets.
>
> Signed-off-by: Alexey Charkov <[email protected]>
> Reviewed-by: Ilias Apalodimas <[email protected]>
>
> disk/part_efi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Simon Glass <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.