]> git.proxmox.com Git - grub2.git/commitdiff
grub_dmraid_nv_detect: Do not divide by zero.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 20 Jan 2015 14:01:58 +0000 (15:01 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 21 Jan 2015 16:42:11 +0000 (17:42 +0100)
ChangeLog
grub-core/disk/dmraid_nvidia.c

index 473eb1466635730f96279bb4af73dd0657a1bcfc..8661726df7fd2d6911849934f4edb54881dc6cd0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-20  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Do not
+       divide by zero.
+
 2015-01-20  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem
index 6e64055291c7836e8c80654d53662ca29de908a4..fc02f5715ccca528a102fc777f4e68a8d05f4c19 100644 (file)
@@ -129,6 +129,9 @@ grub_dmraid_nv_detect (grub_disk_t disk,
     case NV_LEVEL_0:
       level = 0;
       disk_size = sb.capacity / sb.array.total_volumes;
+      if (sb.array.total_volumes == 0)
+       /* Not RAID.  */
+       return NULL;
       break;
 
     case NV_LEVEL_1:
@@ -139,6 +142,9 @@ grub_dmraid_nv_detect (grub_disk_t disk,
     case NV_LEVEL_5:
       level = 5;
       disk_size = sb.capacity / (sb.array.total_volumes - 1);
+      if (sb.array.total_volumes == 0 || sb.array.total_volumes == 1)
+       /* Not RAID.  */
+       return NULL;
       break;
 
     default: