From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesper Schmitz Mouridsen Date: Mon, 8 Feb 2021 18:02:26 +0100 Subject: Wrong check for last block in lib/efi_loader/efi_disk.c? Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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