efi/libstub: gop: Fix EDID support in mixed-mode

The efi_edid_discovered_protocol and efi_edid_active_protocol have mixed
mode fields. So all their attributes should be accessed through
the efi_table_attr() helper.

Doing so fixes the upper 32 bits of the 64 bit gop_edid pointer getting
set to random values (followed by a crash at boot) when booting a x86_64
kernel on a machine with 32 bit UEFI like the Asus T100TA.

Fixes: 17029cdd8f9d ("efi/libstub: gop: Add support for reading EDID")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>

authored by Hans de Goede and committed by Ard Biesheuvel 5688e977 8f0b4cce

+4 -4
+4 -4
drivers/firmware/efi/libstub/gop.c
··· 513 513 status = efi_bs_call(handle_protocol, handle, &EFI_EDID_ACTIVE_PROTOCOL_GUID, 514 514 (void **)&active_edid); 515 515 if (status == EFI_SUCCESS) { 516 - gop_size_of_edid = active_edid->size_of_edid; 517 - gop_edid = active_edid->edid; 516 + gop_size_of_edid = efi_table_attr(active_edid, size_of_edid); 517 + gop_edid = efi_table_attr(active_edid, edid); 518 518 } else { 519 519 status = efi_bs_call(handle_protocol, handle, 520 520 &EFI_EDID_DISCOVERED_PROTOCOL_GUID, 521 521 (void **)&discovered_edid); 522 522 if (status == EFI_SUCCESS) { 523 - gop_size_of_edid = discovered_edid->size_of_edid; 524 - gop_edid = discovered_edid->edid; 523 + gop_size_of_edid = efi_table_attr(discovered_edid, size_of_edid); 524 + gop_edid = efi_table_attr(discovered_edid, edid); 525 525 } 526 526 } 527 527