From: Doug Anderson <dianders@chromium.org>
To: linux-kernel@vger.kernel.org, Jens Axboe <axboe@kernel.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Karel Zak <kzak@redhat.com>,
Matt Fleming <matt.fleming@intel.com>,
Sean Paul <seanpaul@chromium.org>,
Olof Johansson <olof@lixom.net>,
Bill Richardson <wfrichar@chromium.org>,
Josh Triplett <josh@joshtriplett.org>,
Doug Anderson <dianders@chromium.org>,
Davidlohr Bueso <davidlohr@hp.com>
Subject: [PATCH v2] partitions/efi: treat size mismatch as a warning, not an error
Date: Fri, 11 Oct 2013 08:47:34 -0700 [thread overview]
Message-ID: <1381506454-28760-1-git-send-email-dianders@chromium.org> (raw)
In-Reply-To: <1381447702-6240-1-git-send-email-dianders@chromium.org>
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>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
---
Changes in v2:
- Cleaned up comments/warning as per Davidlohr.
block/partitions/efi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 1eb09ee..a8287b4 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;
--
1.8.4
next prev parent reply other threads:[~2013-10-11 15:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-09 23:26 Regression parsing GPT (EFI) partition tables Josh Triplett
2013-10-10 0:37 ` Davidlohr Bueso
2013-10-10 20:15 ` Doug Anderson
2013-10-10 21:26 ` Davidlohr Bueso
2013-10-10 21:53 ` Bill Richardson
2013-10-10 22:31 ` Davidlohr Bueso
2013-10-10 23:40 ` Doug Anderson
2013-10-10 22:29 ` Doug Anderson
2013-10-10 22:49 ` Davidlohr Bueso
2013-10-10 23:28 ` [PATCH] partitions/efi: treat size mismatch as a warning, not an error Doug Anderson
2013-10-11 0:25 ` Josh Triplett
2013-10-11 0:31 ` Davidlohr Bueso
2013-10-11 15:48 ` Doug Anderson
2013-10-11 9:51 ` Karel Zak
2013-10-11 15:53 ` Doug Anderson
2013-10-11 15:47 ` Doug Anderson [this message]
2013-10-11 16:11 ` [PATCH v2] " Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381506454-28760-1-git-send-email-dianders@chromium.org \
--to=dianders@chromium.org \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=davidlohr@hp.com \
--cc=josh@joshtriplett.org \
--cc=kzak@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=olof@lixom.net \
--cc=seanpaul@chromium.org \
--cc=wfrichar@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).