aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Anderson <[email protected]>2013-10-16 13:46:57 -0700
committerLinus Torvalds <[email protected]>2013-10-16 21:35:53 -0700
commit87fc0ad2ad8a15de653f4cef7760fa35e689077f (patch)
tree3c1428036452d8b7a18b9f2cac8f1caefa23cf47
parentef5a22be2c525293b777ccd879a8017c41c7ed5a (diff)
block/partitions/efi.c: treat size mismatch as a warning, not an error
In commit 27a7c642174e ("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 <[email protected]> Reported-by: Sean Paul <[email protected]> Signed-off-by: Doug Anderson <[email protected]> Reviewed-by: Josh Triplett <[email protected]> Acked-by: Davidlohr Bueso <[email protected]> Tested-by: Artem Bityutskiy <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--block/partitions/efi.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 1eb09ee5311b..a8287b49d062 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -222,11 +222,16 @@ 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 larger 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_debug("GPT: mbr size in lba (%u) different than whole disk (%u).\n",
+ sz, min_t(uint32_t,
+ total_sectors - 1, 0xFFFFFFFF));
}
done:
return ret;