All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] skip over invalid BSD partitions
@ 2008-07-30 23:19 Felix Zielcke
  2008-08-01 10:40 ` Marco Gerards
  0 siblings, 1 reply; 11+ messages in thread
From: Felix Zielcke @ 2008-07-30 23:19 UTC (permalink / raw)
  To: The development of GRUB 2

[-- Attachment #1: Type: text/plain, Size: 463 bytes --]

On invalid BSD partitions partmap/pc.c stops with reading the partitons,
so grub doestn't know anything about the ones behind it.
Attached patch fixes this and displays also the partition number not
only the invalid magic it encounters

2008-07-31  Felix Zielcke  <fzielcke@z-51.de>

        * partmap/pc.c (pc_partition_map_iterate): Skip over invalid BSD partitions
	or if there's no space for the disk label and print the partition number on a 
	invalid magic

[-- Attachment #2: skip_invalid_bsd_parts.diff --]
[-- Type: text/x-patch, Size: 1155 bytes --]

Index: partmap/pc.c
===================================================================
--- partmap/pc.c	(Revision 1753)
+++ partmap/pc.c	(Arbeitskopie)
@@ -160,9 +160,11 @@
 		{
 		  /* Check if the BSD label is within the DOS partition.  */
 		  if (p.len <= GRUB_PC_PARTITION_BSD_LABEL_SECTOR)
-		    return grub_error (GRUB_ERR_BAD_PART_TABLE,
-				       "no space for disk label");
-
+		    {
+		      grub_error (GRUB_ERR_BAD_PART_TABLE,
+				  "no space for disk label");
+		      continue;
+		    }
 		  /* Read the BSD label.  */
 		  if (grub_disk_read (&raw,
 				      (p.start
@@ -175,10 +177,12 @@
 		  /* Check if it is valid.  */
 		  if (label.magic
 		      != grub_cpu_to_le32 (GRUB_PC_PARTITION_BSD_LABEL_MAGIC))
-		    return grub_error (GRUB_ERR_BAD_PART_TABLE,
-				       "invalid disk label magic 0x%x",
-				       label.magic);
-
+		    {
+		      grub_error (GRUB_ERR_BAD_PART_TABLE,
+				  "invalid disk label magic 0x%x on partition %d",
+				  label.magic,p.index);
+		      continue;
+		    }
 		  for (pcdata.bsd_part = 0;
 		       pcdata.bsd_part < grub_cpu_to_le16 (label.num_partitions);
 		       pcdata.bsd_part++)

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-08-05 15:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-30 23:19 [PATCH] skip over invalid BSD partitions Felix Zielcke
2008-08-01 10:40 ` Marco Gerards
2008-08-01 10:48   ` Felix Zielcke
2008-08-01 13:02   ` Robert Millan
2008-08-05 10:16     ` Marco Gerards
2008-08-05 10:49       ` Felix Zielcke
2008-08-05 11:38         ` Felix Zielcke
2008-08-05 13:10           ` Marco Gerards
2008-08-05 13:15             ` Felix Zielcke
2008-08-05 13:19             ` Felix Zielcke
2008-08-05 15:41               ` Marco Gerards

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.