osbase/gpt: align partition end
When adding a partition with size=-1, also align the end of the
partition. Otherwise, writes at the end of the partition could write to
the hardware blocks containing the alternate GPT, which increasees the
risk of corruption.
Change-Id: Ib29d0a18c7d91526d1b53a7992974d08255a2e3e
Reviewed-on: https://review.monogon.dev/c/monogon/+/3365
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/osbase/gpt/gpt_test.go b/osbase/gpt/gpt_test.go
index 6691e05..8e63a58 100644
--- a/osbase/gpt/gpt_test.go
+++ b/osbase/gpt/gpt_test.go
@@ -98,7 +98,7 @@
{
name: "empty-fill",
addSize: -1,
- expectParts: []*Partition{{Name: "added", FirstBlock: 2048, LastBlock: 5*2048 - 16384/512 - 2}},
+ expectParts: []*Partition{{Name: "added", FirstBlock: 2048, LastBlock: 5*2048 - 2048 - 1}},
},
{
name: "empty-end",