From cb2ebd0bf7e940f43d835d7517a3556f59580c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Sun, 10 Mar 2019 14:36:07 +0100 Subject: [PATCH] part_block: fix handling of chained EBR's Fixes #3223. --- repos/os/recipes/pkg/test-part_block_mbr/runtime | 9 +++++++++ repos/os/src/server/part_block/mbr.h | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/repos/os/recipes/pkg/test-part_block_mbr/runtime b/repos/os/recipes/pkg/test-part_block_mbr/runtime index 7adda07ad..5a7528425 100644 --- a/repos/os/recipes/pkg/test-part_block_mbr/runtime +++ b/repos/os/recipes/pkg/test-part_block_mbr/runtime @@ -5,6 +5,7 @@ + Tests finished successfully!* Tests finished successfully!* Tests finished successfully! @@ -51,6 +52,7 @@ + @@ -75,5 +77,12 @@ + + + + + + + diff --git a/repos/os/src/server/part_block/mbr.h b/repos/os/src/server/part_block/mbr.h index 2a1f92977..082dd10d2 100644 --- a/repos/os/src/server/part_block/mbr.h +++ b/repos/os/src/server/part_block/mbr.h @@ -84,6 +84,7 @@ struct Mbr_partition_table : public Block::Partition_table { Partition_record *r = record; unsigned lba = r->_lba; + unsigned last_lba = 0; /* first logical partition number */ int nr = 5; @@ -106,7 +107,9 @@ struct Mbr_partition_table : public Block::Partition_table * (relative form this EBR) */ r = &(ebr->_records[1]); - lba += ebr->_records[1]._lba; + lba += ebr->_records[1]._lba - last_lba; + + last_lba = ebr->_records[1]._lba; } while (r->valid()); }