Re: [PATCH 2/6] disk: part_efi: Add missing endianness conversions
Alexey Charkov <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <CAKTNdwFebx34Bvz+Tpj=ay-uK7s6f=qcRXTgCpb=bRczw9x9KA@mail.gmail.com> |
Hello Heinrich, On Tue, Aug 25, 2026 at 11:03 PM Heinrich Schuchardt <[email protected]> wrote: > > On 7/31/26 14:40, Alexey Charkov wrote: > > 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]> > > This change is not covered by the test in patch 6/6 as it runs only on > the sandbox. > > Please, ensure that the GPT tests are also executed on a big-endian > systems, e.g malta64_defconfig which run in the CI via QEMU. > > Reviewed-by: Heinrich Schuchardt <[email protected]> I've added malta64 based tests in my WIP v2 version and caught more of the same :) Thanks for the suggestion! Best regards, Alexey