All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Schmitz Mouridsen <jsm@FreeBSD.org>
To: u-boot@lists.denx.de
Subject: Wrong check for last block in lib/efi_loader/efi_disk.c?
Date: Mon, 8 Feb 2021 18:02:26 +0100	[thread overview]
Message-ID: <b34c1c02-fdd7-254b-d918-2066ae70c722@FreeBSD.org> (raw)

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	other threads:[~2021-02-08 17:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b34c1c02-fdd7-254b-d918-2066ae70c722@FreeBSD.org \
    --to=jsm@freebsd.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.