]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Detect spares
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 6 Apr 2011 10:29:49 +0000 (12:29 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 6 Apr 2011 10:29:49 +0000 (12:29 +0200)
and report them as not RAID members since they are useless for GRUB.
* grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Likewise.

ChangeLog
grub-core/disk/mdraid1x_linux.c
grub-core/disk/mdraid_linux.c

index 667daad6555cc62640ab2682636bb9cdcd4b9670..81ba177d53a68cb90c730b02505d6c9ceb2f0a10 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-06  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/disk/mdraid1x_linux.c (grub_mdraid_detect): Detect spares
+       and report them as not RAID members since they are useless for GRUB.
+       * grub-core/disk/mdraid_linux.c (grub_mdraid_detect): Likewise.
+
 2011-04-02  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Increase LVM implementation robustness in order not to crash on
index 1d08abf5b12992ef13de28eb0ef967b43da72925..e308783651bc633f34a5f5dfb3547a5f90968e37 100644 (file)
@@ -200,11 +200,14 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
 
        if (grub_le_to_cpu32 (real_sb->dev_number) >=
            grub_le_to_cpu32 (real_sb->max_dev))
-         return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+         return grub_error (GRUB_ERR_OUT_OF_RANGE,
                             "spares aren't implemented");
 
        array->index = grub_le_to_cpu16
          (real_sb->dev_roles[grub_le_to_cpu32 (real_sb->dev_number)]);
+       if (array->index >= array->total_devs)
+         return grub_error (GRUB_ERR_OUT_OF_RANGE,
+                            "spares aren't implemented");
        array->uuid_len = 16;
        array->uuid = grub_malloc (16);
        if (!array->uuid)
index 7aa48fd7a3b0d08b7ff4a2fe9fea9d2d74907835..06d3498a8f13c41075da0a27f5e76ef124cf8a69 100644 (file)
@@ -202,7 +202,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
                       "unsupported RAID level: %d", level);
   if (grub_le_to_cpu32 (sb.this_disk.number) == 0xffff
       || grub_le_to_cpu32 (sb.this_disk.number) == 0xfffe)
-    return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+    return grub_error (GRUB_ERR_OUT_OF_RANGE,
                       "spares aren't implemented");
 
   array->name = NULL;