Messages in this thread Patch in this message | | | From | Doug Anderson <> | Subject | [PATCH] partitions/efi: treat size mismatch as a warning, not an error | Date | Thu, 10 Oct 2013 16:28:22 -0700 |
| |
In (27a7c64 partitions/efi: account for pmbr size in lba) we started treating bad sizes in lba field of the partition that has the 0xEE (GPT protective) as errors. However, we may run into these "bad sizes" in the real world if someone uses dd to copy an image from a smaller disk to a bigger disk. Since this case used to work (even without using force_gpt), keep it working and treat the size mismatch as a warning instead of an error.
Reported-by: Josh Triplett <josh@joshtriplett.org> Reported-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> --- block/partitions/efi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c index 1eb09ee..ac23dc1 100644 --- a/block/partitions/efi.c +++ b/block/partitions/efi.c @@ -222,11 +222,15 @@ check_hybrid: * the disk size. * * Hybrid MBRs do not necessarily comply with this. + * + * Consider a bad value here to be a warning to support dd-ing + * an image from a smaller disk to a bigger disk. */ if (ret == GPT_MBR_PROTECTIVE) { sz = le32_to_cpu(mbr->partition_record[part].size_in_lba); if (sz != (uint32_t) total_sectors - 1 && sz != 0xFFFFFFFF) - ret = 0; + pr_warn("%s: mbr size mismatch (%u != %u)\n", __func__, + sz, (uint32_t)((uint32_t) total_sectors - 1)); } done: return ret; -- 1.8.4
| |