mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: andrew.smirnov@gmail.com
Subject: [PATCH] partitions/efi: Fix off-by-one error in 'last_lba'
Date: Mon, 10 Nov 2014 09:44:00 -0800	[thread overview]
Message-ID: <1415641440-19318-1-git-send-email-andrew.smirnov@gmail.com> (raw)

LBAs are numbered starting from zero so the last LBA # would be equal
to total number of blocks minus one.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 common/partitions/efi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index dcb9541..80dc3f3 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -51,11 +51,11 @@ efi_crc32(const void *buf, unsigned long len)
  *  the part[0] entry for this disk, and is the number of
  *  physical sectors available on the disk.
  */
-static u64 last_lba(struct block_device *bdev)
+static u64  last_lba(struct block_device *bdev)
 {
 	if (!bdev)
 		return 0;
-	return bdev->num_blocks;
+	return bdev->num_blocks - 1;
 }
 
 /**
-- 
1.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2014-11-10 17:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10 17:44 Andrey Smirnov [this message]
2014-11-11 14:02 ` Sascha Hauer

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=1415641440-19318-1-git-send-email-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox