Blob Blame Raw
From fbc6f5faf45f489125f98a11f3593cd43b4d6b76 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Wed, 19 Sep 2012 02:44:54 +0100
Subject: [PATCH 044/482] * grub-core/partmap/msdos.c (pc_partition_map_embed):
 Revert incorrect off-by-one fix from 2011-02-12.  A 62-sector core image
 should fit before end == 63.

---
 ChangeLog                 | 6 ++++++
 grub-core/partmap/msdos.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1ab401d..5db804e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2012-09-19  Colin Watson  <cjwatson@ubuntu.com>
 
+	* grub-core/partmap/msdos.c (pc_partition_map_embed): Revert
+	incorrect off-by-one fix from 2011-02-12.  A 62-sector core image
+	should fit before end == 63.
+
+2012-09-19  Colin Watson  <cjwatson@ubuntu.com>
+
 	* util/grub-setup.c (write_rootdev): Remove unused core_img
 	parameter.  Update all callers.
 	(setup): Define core_sectors only if GRUB_SETUP_BIOS, to appease
diff --git a/grub-core/partmap/msdos.c b/grub-core/partmap/msdos.c
index 6e54a74..10ca3f0 100644
--- a/grub-core/partmap/msdos.c
+++ b/grub-core/partmap/msdos.c
@@ -316,14 +316,14 @@ pc_partition_map_embed (struct grub_disk *disk, unsigned int *nsectors,
 	break;
     }
 
-  if (end >= *nsectors + 2)
+  if (end >= *nsectors + 1)
     {
       unsigned i, j;
       char *embed_signature_check;
       unsigned int orig_nsectors, avail_nsectors;
 
       orig_nsectors = *nsectors;
-      *nsectors = end - 2;
+      *nsectors = end - 1;
       avail_nsectors = *nsectors;
       if (*nsectors > max_nsectors)
 	*nsectors = max_nsectors;
-- 
1.8.2.1