aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_disk.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-01-30 14:49:17 -0500
committerTom Rini <trini@konsulko.com>2021-01-30 14:49:17 -0500
commit76404f86a24aa28efc26a296bf6ab9d697c60b9f (patch)
tree94d44ddf983d8b5b9cdeeae6df5c9d7cff1142ab /lib/efi_loader/efi_disk.c
parent472a716b8fdfd88a27cb675e4ea8e12cb4f79fc3 (diff)
parent18dd984c56b339be74e390df80fd3dc21b7a9b58 (diff)
Merge tag 'efi-2021-04-rc1-4' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2021-04-rc1-4 Bug fixes: * re-read the partition table after writing GPT * fix a problem booting ARMv7 boards with PSCI without UEFI * make aarch64 UEFI test programs compatible with GRUB linux command * correct the alignment check in the EFI_BLOCK_IO_PROTOCOL * check EFI_BLOCK_IO_PROTOCOL.Media->LastBlock in unit test
Diffstat (limited to 'lib/efi_loader/efi_disk.c')
-rw-r--r--lib/efi_loader/efi_disk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index c0804effde..d0aad0252a 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -142,8 +142,9 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this,
return EFI_MEDIA_CHANGED;
if (!this->media->media_present)
return EFI_NO_MEDIA;
- /* media->io_align is a power of 2 */
- if ((uintptr_t)buffer & (this->media->io_align - 1))
+ /* media->io_align is a power of 2 or 0 */
+ if (this->media->io_align &&
+ (uintptr_t)buffer & (this->media->io_align - 1))
return EFI_INVALID_PARAMETER;
if (lba * this->media->block_size + buffer_size >
this->media->last_block * this->media->block_size)
@@ -209,8 +210,9 @@ static efi_status_t EFIAPI efi_disk_write_blocks(struct efi_block_io *this,
return EFI_MEDIA_CHANGED;
if (!this->media->media_present)
return EFI_NO_MEDIA;
- /* media->io_align is a power of 2 */
- if ((uintptr_t)buffer & (this->media->io_align - 1))
+ /* media->io_align is a power of 2 or 0 */
+ if (this->media->io_align &&
+ (uintptr_t)buffer & (this->media->io_align - 1))
return EFI_INVALID_PARAMETER;
if (lba * this->media->block_size + buffer_size >
this->media->last_block * this->media->block_size)