mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] partitions/efi: Fix off-by-one error in 'last_lba'
@ 2014-11-10 17:44 Andrey Smirnov
  2014-11-11 14:02 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2014-11-10 17:44 UTC (permalink / raw)
  To: barebox; +Cc: andrew.smirnov

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] partitions/efi: Fix off-by-one error in 'last_lba'
  2014-11-10 17:44 [PATCH] partitions/efi: Fix off-by-one error in 'last_lba' Andrey Smirnov
@ 2014-11-11 14:02 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-11-11 14:02 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Mon, Nov 10, 2014 at 09:44:00AM -0800, Andrey Smirnov wrote:
> 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>

Applied, thanks.


> ---
>  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)

Dropped this hunk while applying.

Sascha

>  {
>  	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
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-11 14:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-10 17:44 [PATCH] partitions/efi: Fix off-by-one error in 'last_lba' Andrey Smirnov
2014-11-11 14:02 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox