Hi

I was not able to read the last block of my sd card

(the gpt backup block) without the following

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index d0aad0252a..ea9d763072 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -147,7 +147,7 @@ static efi_status_t EFIAPI efi_disk_read_blocks(struct efi_block_io *this,
            (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)
+           this->media->last_block * this->media->block_size + this->media->block_size)
                return EFI_INVALID_PARAMETER;

Is my math wrong or is my patch correct?

With the patch the my efiloader can read the gpt backup block correctly,

Thanks

/Jesper

Reply via email to